// import { iconMap } from '../../../../src/page/soft/edit/SYSML1/treeIcon'
/**
 * Copyright (c) 2006-2012, JGraph Ltd
 */
/**
 * 为给定的编辑器UI和容器元素构造一个新的侧边栏。
 * 侧边栏为图形编辑器提供形状和工具的调色板，用户可以从中拖拽元素到画布上。
 *
 * @param {Object} editorUi - 管理侧边栏的编辑器UI实例
 * @param {HTMLElement} container - 侧边栏的DOM容器元素
 */
function Sidebar(editorUi, container) {
  // 编辑器UI实例，用于管理侧边栏与主编辑器的交互
  this.editorUi = editorUi;
  // 侧边栏的DOM容器元素，所有面板都将添加到此容器中
  this.container = container;
  // 存储所有已注册的调色板，便于管理和访问
  this.palettes = new Object();
  // 存储标签列表，用于搜索和索引功能
  this.taglist = new Object();
  // 控制工具提示是否显示的标志
  this.showTooltips = true;

  // 创建临时图形实例，用于渲染缩略图和预览
  this.graph = editorUi.createTemporaryGraph(this.editorUi.editor.graph.getStylesheet());
  this.graph.cellRenderer.minSvgStrokeWidth = this.minThumbStrokeWidth;
  this.graph.cellRenderer.antiAlias = this.thumbAntiAlias;
  this.graph.container.style.visibility = 'hidden';
  this.graph.foldingEnabled = false;

  document.body.appendChild(this.graph.container);

  // 鼠标释放事件处理器，重新启用工具提示
  this.pointerUpHandler = mxUtils.bind(this, function () {
    this.showTooltips = true;
  });

  mxEvent.addListener(document, (mxClient.IS_POINTER) ? 'pointerup' : 'mouseup', this.pointerUpHandler);

  // 鼠标按下事件处理器，暂时禁用工具提示
  this.pointerDownHandler = mxUtils.bind(this, function () {
    this.showTooltips = false;
    this.hideTooltip();
  });

  mxEvent.addListener(document, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown', this.pointerDownHandler);

  // 鼠标移动事件处理器，用于检测鼠标是否离开当前元素
  this.pointerMoveHandler = mxUtils.bind(this, function (evt) {
    var src = mxEvent.getSource(evt);

    while (src != null) {
      if (src == this.currentElt) {
        return;
      }

      src = src.parentNode;
    }

    this.hideTooltip();
  });

  mxEvent.addListener(document, (mxClient.IS_POINTER) ? 'pointermove' : 'mousemove', this.pointerMoveHandler);

  // 处理鼠标离开窗口的事件
  this.pointerOutHandler = mxUtils.bind(this, function (evt) {
    if (evt.toElement == null && evt.relatedTarget == null) {
      this.hideTooltip();
    }
  });

  mxEvent.addListener(document, (mxClient.IS_POINTER) ? 'pointerout' : 'mouseout', this.pointerOutHandler);

  // 滚动事件监听器，启用工具提示
  mxEvent.addListener(container, 'scroll', mxUtils.bind(this, function () {
    this.showTooltips = true;
    this.hideTooltip();
  }));
  // 显示类型配置，用于控制侧边栏的显示模式
  this.displayType = null;
  // 初始化侧边栏，添加所有调色板
  this.init();
};

/**
 * 初始化侧边栏，添加所有调色板和基本功能。
 * 根据当前选中的节点类型动态添加相应的调色板。
 */
Sidebar.prototype.init = function () {

  console.log("start sideBar.js......0921");

  const dir = STENCIL_PATH;
  this.displayType = mxUtils.load(STYLE_PATH + '/displayType.xml').getXml().documentElement;

  // 添加工具调色板
  this.addToolPalette(true);
  // 添加绘图组件调色板
  this.addDiagramPalette(true);

  const addPalette = ['general_drawing', 'model_diagram'].includes(window.zTreeObj && window.zTreeObj.currentSelectedNode && window.zTreeObj.currentSelectedNode.type)
  // 根据节点类型添加通用调色板
  addPalette && this.addGeneralPalette(false);
  // 根据节点类型添加箭头调色板
  addPalette && this.addStencilPalette('arrows', mxResources.get('arrows'), dir + '/arrows.xml', ';whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=2');
  // 开启对齐指引功能
  // this.hasTimeaxis && !window.isGuideModel && (this.graph.graphHandler.guidesEnabled = true);
};

/**
 * 检查是否存在时间轴元素。
 * 只读属性，用于判断当前侧边栏中是否包含时间轴类型的元素。
 */
Object.defineProperty(Sidebar.prototype, 'hasTimeaxis', {
  get() {
    return this.cellAndStyleMap.some(i => i.display === 'LABEL_TIMEAXIS' && i.type === Sidebar.EntityTypeMap.timeaxis)
  }
})

/**
 * 折叠状态下的图片资源。
 * 用于显示调色板折叠时的图标，支持SVG和GIF格式。
 */
Sidebar.prototype.collapsedImage = (!mxClient.IS_SVG) ? IMAGE_PATH + '/collapsed.gif' : '';

/**
 * 展开状态下的图片资源。
 * 用于显示调色板展开时的图标，支持SVG和GIF格式。
 */
Sidebar.prototype.expandedImage = (!mxClient.IS_SVG) ? IMAGE_PATH + '/expanded.gif' : '';

/**
 * 搜索功能的图标资源。
 * 用于侧边栏搜索框中的搜索按钮图标。
 */
Sidebar.prototype.searchImage = (!mxClient.IS_SVG) ? IMAGE_PATH + '/search.png' : '';

/**
 * 拖拽预览边框样式。
 * 定义拖拽时预览元素的边框样式。
 */
Sidebar.prototype.dragPreviewBorder = '1px dashed black';

/**
 * 控制是否启用工具提示功能。
 * 当启用时，悬停在侧边栏项目上会显示详细信息。默认为true。
 */
Sidebar.prototype.enableTooltips = true;

/**
 * 工具提示边框宽度。
 * 定义工具提示框的内边距大小。默认为16像素。
 */
Sidebar.prototype.tooltipBorder = 16;

/**
 * 工具提示显示延迟时间。
 * 鼠标悬停后延迟多长时间显示工具提示。默认为300毫秒。
 */
Sidebar.prototype.tooltipDelay = 300;

/**
 * 拖拽目标图标显示延迟时间。
 * 拖拽元素时延迟多长时间显示目标图标。默认为200毫秒。
 */
Sidebar.prototype.dropTargetDelay = 200;

/**
 * 齿轮图标的URL路径。
 * 用于侧边栏中齿轮形状的图标资源。
 */
Sidebar.prototype.gearImage = STENCIL_PATH + '/clipart/Gear_128x128.png';

/**
 * 缩略图的宽度。
 * 定义侧边栏中形状缩略图的宽度。默认为31像素。
 */
Sidebar.prototype.thumbWidth = 31;

/**
 * 缩略图的高度。
 * 定义侧边栏中形状缩略图的高度。默认为25像素。
 */
Sidebar.prototype.thumbHeight = 25;

/**
 * 缩略图最小笔画宽度。
 * 定义缩略图中线条的最小宽度，确保在小尺寸下仍清晰可见。默认为1像素。
 */
Sidebar.prototype.minThumbStrokeWidth = 1;

/**
 * 缩略图是否启用抗锯齿。
 * 控制缩略图渲染时是否使用抗锯齿功能以获得更平滑的显示效果。默认为false。
 */
Sidebar.prototype.thumbAntiAlias = false;

/**
 * 缩略图的内边距。
 * 定义缩略图内容与边框之间的填充空间。默认为3像素。
 */
Sidebar.prototype.thumbPadding = (document.documentMode >= 5) ? 2 : 3;

/**
 * 缩略图边框宽度。
 * 定义缩略图边框的宽度。默认为2像素。
 */
Sidebar.prototype.thumbBorder = 2;

/*
 * 实验性功能：较小的侧边栏条目
 * 当URL参数sidebar-entries不等于'large'时，使用更小的缩略图尺寸
 */
if (urlParams['sidebar-entries'] != 'large') {
  Sidebar.prototype.thumbPadding = (document.documentMode >= 5) ? 0 : 1;
  Sidebar.prototype.thumbBorder = 1;
  Sidebar.prototype.thumbWidth = 25; // 原数据 62
  Sidebar.prototype.thumbHeight = 20; // 原数据 50
  Sidebar.prototype.minThumbStrokeWidth = 1.3;
  Sidebar.prototype.thumbAntiAlias = true;
}

/**
 * 侧边栏标题的字体大小。
 * 定义侧边栏中调色板标题的字体大小。默认为9像素。
 */
Sidebar.prototype.sidebarTitleSize = 9;

/**
 * 控制是否在侧边栏中显示标题。
 * 当启用时，侧边栏的调色板会显示标题文本。默认为false。
 */
Sidebar.prototype.sidebarTitles = false;

/**
 * 控制是否在工具提示中显示标题。
 * 当启用时，工具提示会包含元素的标题信息。默认为true。
 */
Sidebar.prototype.tooltipTitles = true;

/**
 * 工具提示的最大宽度。
 * 限制工具提示的最大显示宽度。默认为400像素。
 */
Sidebar.prototype.maxTooltipWidth = 400;

/**
 * 工具提示的最大高度。
 * 限制工具提示的最大显示高度。默认为400像素。
 */
Sidebar.prototype.maxTooltipHeight = 400;

/**
 * 控制是否将模板文件添加到搜索索引中。
 * 当启用时，模板调色板添加时会预加载模板文件到搜索索引中。
 * 如果为false，则在显示调色板时延迟加载模板文件。
 */
Sidebar.prototype.addStencilsToIndex = true;

/**
 * 默认图片宽度。
 * 定义剪贴画图片的默认宽度。默认为80像素。
 */
Sidebar.prototype.defaultImageWidth = 80;

/**
 * 默认图片高度。
 * 定义剪贴画图片的默认高度。默认为80像素。
 */
Sidebar.prototype.defaultImageHeight = 80;

/**
 * 获取工具提示的偏移量。
 * 返回工具提示相对于鼠标位置的偏移坐标。
 *
 * @returns {mxPoint} 工具提示的偏移坐标
 */
Sidebar.prototype.getTooltipOffset = function () {
  return new mxPoint(0, 0);
};

/**
 * 显示工具提示。
 * 为指定的侧边栏元素显示工具提示，包含形状的预览和标题信息。
 *
 * @param {HTMLElement} elt - 要显示工具提示的DOM元素
 * @param {Array} cells - 要预览的图形单元格数组
 * @param {number} w - 工具提示的宽度
 * @param {number} h - 工具提示的高度
 * @param {string} title - 工具提示的标题
 * @param {boolean} showLabel - 是否显示标签
 */
Sidebar.prototype.showTooltip = function (elt, cells, w, h, title, showLabel) {
  if (this.enableTooltips && this.showTooltips) {
    if (this.currentElt != elt) {
      if (this.thread != null) {
        window.clearTimeout(this.thread);
        this.thread = null;
      }

      var show = mxUtils.bind(this, function () {
        // 延迟创建DOM节点和图形实例
        if (this.tooltip == null) {
          this.tooltip = document.createElement('div');
          this.tooltip.className = 'geSidebarTooltip';
          this.tooltip.style.zIndex = mxPopupMenu.prototype.zIndex - 1;
          document.body.appendChild(this.tooltip);

          this.graph2 = new Graph(this.tooltip, null, null, this.editorUi.editor.graph.getStylesheet());
          this.graph2.resetViewOnRootChange = false;
          this.graph2.foldingEnabled = false;
          this.graph2.gridEnabled = false;
          this.graph2.autoScroll = false;
          this.graph2.setTooltips(false);
          this.graph2.setConnectable(false);
          this.graph2.setEnabled(false);

          if (!mxClient.IS_SVG) {
            this.graph2.view.canvas.style.position = 'relative';
          }
        }

        this.graph2.model.clear();
        this.graph2.view.setTranslate(this.tooltipBorder, this.tooltipBorder);

        if (w > this.maxTooltipWidth || h > this.maxTooltipHeight) {
          this.graph2.view.scale = Math.round(Math.min(this.maxTooltipWidth / w, this.maxTooltipHeight / h) * 100) / 100;
        } else {
          this.graph2.view.scale = 1;
        }

        this.tooltip.style.display = 'block';
        this.graph2.labelsVisible = (showLabel == null || showLabel);
        var fo = mxClient.NO_FO;
        mxClient.NO_FO = Editor.prototype.originalNoForeignObject;

        // 为预览应用当前样式
        var temp = this.graph2.cloneCells(cells);
        this.editorUi.insertHandler(temp, null, this.graph2.model);
        if (temp[0] instanceof Object && temp[0].getValue() instanceof Object) {
          temp[0].getValue().setAttribute("isInit", 'true');
        }
        this.graph2.addCells(temp);

        mxClient.NO_FO = fo;

        var bounds = this.graph2.getGraphBounds();
        var width = bounds.width + 2 * this.tooltipBorder + 4;
        var height = bounds.height + 2 * this.tooltipBorder;

        this.tooltip.style.overflow = 'visible';
        this.tooltip.style.width = width + 'px';
        var w2 = width;

        // 为条目添加标题
        if (this.tooltipTitles && title != null && title.length > 0) {
          if (this.tooltipTitle == null) {
            this.tooltipTitle = document.createElement('div');
            this.tooltipTitle.style.borderTop = '1px solid gray';
            this.tooltipTitle.style.textAlign = 'center';
            this.tooltipTitle.style.width = '100%';
            this.tooltipTitle.style.overflow = 'hidden';
            this.tooltipTitle.style.position = 'absolute';
            this.tooltipTitle.style.paddingTop = '6px';
            this.tooltipTitle.style.bottom = '6px';

            this.tooltip.appendChild(this.tooltipTitle);
          } else {
            this.tooltipTitle.innerHTML = '';
          }

          this.tooltipTitle.style.display = '';
          mxUtils.write(this.tooltipTitle, title);

          // 允许更宽的标签
          w2 = Math.min(this.maxTooltipWidth, Math.max(width, this.tooltipTitle.scrollWidth + 4));
          var ddy = this.tooltipTitle.offsetHeight + 10;
          height += ddy;

          if (mxClient.IS_SVG) {
            this.tooltipTitle.style.marginTop = (2 - ddy) + 'px';
          } else {
            height -= 6;
            this.tooltipTitle.style.top = (height - ddy) + 'px';
          }
        } else if (this.tooltipTitle != null && this.tooltipTitle.parentNode != null) {
          this.tooltipTitle.style.display = 'none';
        }

        // 如果标签更宽则更新宽度
        if (w2 > width) {
          this.tooltip.style.width = w2 + 'px';
        }

        this.tooltip.style.height = height + 'px';
        var x0 = -Math.round(bounds.x - this.tooltipBorder) +
          ((w2 > width) ? (w2 - width) / 2 : 0);
        var y0 = -Math.round(bounds.y - this.tooltipBorder);

        var b = document.body;
        var d = document.documentElement;
        var off = this.getTooltipOffset();
        var bottom = Math.max(b.clientHeight || 0, d.clientHeight);
        var left = this.container.clientWidth + this.editorUi.splitSize + 3 + this.editorUi.container.offsetLeft + off.x;
        var top = Math.min(bottom - height - 20 /*status bar*/ , Math.max(0, (this.editorUi.container.offsetTop +
          this.container.offsetTop + elt.offsetTop - this.container.scrollTop - height / 2 + 16))) + off.y;

        if (mxClient.IS_SVG) {
          if (x0 != 0 || y0 != 0) {
            this.graph2.view.canvas.setAttribute('transform', 'translate(' + x0 + ',' + y0 + ')');
          } else {
            this.graph2.view.canvas.removeAttribute('transform');
          }
        } else {
          this.graph2.view.drawPane.style.left = x0 + 'px';
          this.graph2.view.drawPane.style.top = y0 + 'px';
        }

        // IE9中忽略位置CSS样式的解决方法
        // （没有以下行会变为相对定位）
        this.tooltip.style.position = 'absolute';

        this.tooltip.style.left = left + 'px';

        // if(window.isSysml) {
        //   // 树 引用
        //   if(!(cells[0] && cells[0].value instanceof Object && cells[0].value.getAttribute("selectQuote") === 'false')) {
        //     this.tooltip.style.left = left + 200 + 'px';
        //   }
        // }

        this.tooltip.style.top = top + 'px';
      });

      if (this.tooltip != null && this.tooltip.style.display != 'none') {
        show();
      } else {
        this.thread = window.setTimeout(show, this.tooltipDelay);
      }

      this.currentElt = elt;
    }
  }
};

/**
 * 隐藏当前工具提示。
 * 清除任何待处理的工具提示显示定时器，并立即隐藏工具提示。
 */
Sidebar.prototype.hideTooltip = function () {
  if (this.thread != null) {
    window.clearTimeout(this.thread);
    this.thread = null;
  }

  if (this.tooltip != null) {
    this.tooltip.style.display = 'none';
    this.currentElt = null;
  }
};

/**
 * 添加数据条目到侧边栏。
 * 根据提供的数据创建顶点模板条目，并添加到搜索索引中。
 *
 * @param {string} tags - 条目的标签，用于搜索和索引
 * @param {number} width - 模板的宽度
 * @param {number} height - 模板的高度
 * @param {string} title - 条目的标题
 * @param {string} data - 图形数据，用于创建模板
 * @returns {Object} 创建的条目对象
 */
Sidebar.prototype.addDataEntry = function (tags, width, height, title, data) {
  return this.addEntry(tags, mxUtils.bind(this, function () {
    return this.createVertexTemplateFromData(data, width, height, title);
  }));
};

/**
 * 将给定的条目添加到搜索索引中。
 * 处理图片数组，为每个图片创建搜索条目并添加到索引中。
 *
 * @param {Array} images - 包含图片信息的数组，每个元素包含data、title、tags等属性
 */
Sidebar.prototype.addEntries = function (images) {
  for (var i = 0; i < images.length; i++) {
    (mxUtils.bind(this, function (img) {
      var data = img.data;
      var tags = (img.title != null) ? img.title : '';

      if (img.tags != null) {
        tags += ' ' + img.tags;
      }

      if (data != null && tags.length > 0) {
        this.addEntry(tags, mxUtils.bind(this, function () {
          data = this.editorUi.convertDataUri(data);
          var s = 'shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;';

          if (img.aspect == 'fixed') {
            s += 'aspect=fixed;'
          }

          return this.createVertexTemplate(s + 'image=' +
            data, img.w, img.h, '', img.title || '', false, false, true)
        }));
      } else if (img.xml != null && tags.length > 0) {
        this.addEntry(tags, mxUtils.bind(this, function () {
          var cells = this.editorUi.stringToCells(Graph.decompress(img.xml));

          return this.createVertexTemplateFromCells(
            cells, img.w, img.h, img.title || '', true, false, true);
        }));
      }
    }))(images[i]);
  }
};

/**
 * 设置当前搜索条目库。
 * 指定当前正在处理的搜索条目库，用于跟踪条目的来源。
 *
 * @param {string} id - 库的唯一标识符
 * @param {Object} lib - 库对象
 */
Sidebar.prototype.setCurrentSearchEntryLibrary = function (id, lib) {
  this.currentSearchEntryLibrary = (id != null) ? {
    id: id,
    lib: lib
  } : null;
};

/**
 * 添加条目到搜索索引。
 * 将具有指定标签的条目添加到侧边栏的搜索索引中，便于用户搜索。
 *
 * @param {string} tags - 条目的标签字符串，用于搜索匹配
 * @param {Function} fn - 创建条目的函数
 */
Sidebar.prototype.addEntry = function (tags, fn) {
  if (this.taglist != null && tags != null && tags.length > 0) {
    if (this.currentSearchEntryLibrary != null) {
      fn.parentLibraries = [this.currentSearchEntryLibrary];
    }

    // 替换特殊字符，将标签转换为小写并用空格分割
    var tmp = tags.toLowerCase().replace(/[\/\,\(\)]/g, ' ').split(' ');
    var tagList = [];
    var hash = {};

    // 查找唯一标签，避免重复
    for (var i = 0; i < tmp.length; i++) {
      if (hash[tmp[i]] == null) {
        hash[tmp[i]] = true;
        tagList.push(tmp[i]);
      }

      // 添加移除尾部数字后的额外条目，用于更宽泛的搜索匹配
      var normalized = tmp[i].replace(/\.*\d*$/, '');

      if (normalized != tmp[i]) {
        if (hash[normalized] == null) {
          hash[normalized] = true;
          tagList.push(normalized);
        }
      }
    }

    for (var i = 0; i < tagList.length; i++) {
      this.addEntryForTag(tagList[i], fn);
    }
  }

  return fn;
};

/**
 * 为指定的标签添加条目。
 * 将条目函数添加到标签索引中，便于后续按标签搜索。
 *
 * @param {string} tag - 标签名称
 * @param {Function} fn - 创建条目的函数
 */
Sidebar.prototype.addEntryForTag = function (tag, fn) {
  if (tag != null && tag.length > 1) {
    var entry = this.taglist[tag];

    if (typeof entry !== 'object') {
      entry = {
        entries: []
      };
      this.taglist[tag] = entry;
    }

    entry.entries.push(fn);
  }
};

/**
 * 搜索条目。
 * 根据搜索词在标签索引中查找匹配的条目，支持分页返回结果。
 *
 * @param {string} searchTerms - 搜索词，用空格分隔多个词
 * @param {number} count - 每页返回的条目数量
 * @param {number} page - 页码（从0开始）
 * @param {Function} success - 搜索成功的回调函数
 * @param {Function} error - 搜索失败的回调函数
 */
Sidebar.prototype.searchEntries = function (searchTerms, count, page, success, error) {
  if (this.taglist != null && searchTerms != null) {
    var tmp = searchTerms.toLowerCase().split(' ');
    var dict = new mxDictionary();
    var max = (page + 1) * count;
    var results = [];
    var index = 0;

    for (var i = 0; i < tmp.length; i++) {
      if (tmp[i].length > 0) {
        var entry = this.taglist[tmp[i]];
        var tmpDict = new mxDictionary();

        if (entry != null) {
          var arr = entry.entries;
          results = [];

          for (var j = 0; j < arr.length; j++) {
            var entry = arr[j];

            // 注意：数组不包含重复项
            if ((index == 0) == (dict.get(entry) == null)) {
              tmpDict.put(entry, entry);
              results.push(entry);

              if (i == tmp.length - 1 && results.length == max) {
                success(results.slice(page * count, max), max, true, tmp);

                return;
              }
            }
          }
        } else {
          results = [];
        }

        dict = tmpDict;
        index++;
      }
    }

    var len = results.length;
    success(results.slice(page * count, (page + 1) * count), len, false, tmp);
  } else {
    success([], null, null, tmp);
  }
};

/**
 * 过滤和清理标签字符串。
 * 移除重复的标签项，返回清理后的标签字符串。
 *
 * @param {string} tags - 要过滤的标签字符串，用空格分隔
 * @returns {string} 过滤后的标签字符串，或null如果输入为空
 */
Sidebar.prototype.filterTags = function (tags) {
  if (tags != null) {
    var arr = tags.split(' ');
    var result = [];
    var hash = {};
    // 忽略以数字开头的标签，移除尾部数字
    for (var i = 0; i < arr.length; i++) {
      // 移除重复项
      if (hash[arr[i]] == null) {
        hash[arr[i]] = '1';
        result.push(arr[i]);
      }
    }
    return result.join(' ');
  }
  return null;
};

/**
 * 克隆单元格。
 * 创建指定单元格的克隆副本，可选择设置新的值。
 *
 * @param {mxCell} cell - 要克隆的单元格
 * @param {Object} value - 可选的新值，用于替换克隆单元格的值
 * @returns {mxCell} 克隆的单元格
 */
Sidebar.prototype.cloneCell = function (cell, value) {
  var clone = cell.clone();

  if (value != null) {
    clone.value = value;
  }

  return clone;
};

/**
 * 为指定的条目显示弹出菜单。
 * 显示条目的上下文菜单，提供额外的操作选项。
 * 子类可以重写此方法来提供自定义的弹出菜单。
 *
 * @param {HTMLElement} elt - 条目的DOM元素
 * @param {Array} libs - 可用的库列表
 * @param {Event} evt - 触发事件
 */
Sidebar.prototype.showPopupMenuForEntry = function (elt, libs, evt) {
  // 子类扩展钩子
};
/**
 * 根据display属性获取对应的显示配置。
 * 在displayType配置中查找匹配的显示项。
 *
 * @param {string} display - 要查找的display属性值
 * @returns {Element} 匹配的显示配置元素，或undefined如果未找到
 */
Sidebar.prototype.getDisplay = function (display) {
  var result;
  $.each(this.displayType.children, function (index, value) {
    if (value.getAttribute('display') == display) {
      result = value;
      return false;
    }
  })
  return result;
}

/**
 * 根据XML配置生成函数数组。
 * 解析XML配置，创建用于生成可扩展图形元素对象的函数集合。
 *
 * @param {string} objectXml - 包含模型定义的XML字符串
 */
Sidebar.prototype.createFns = function (objectXml) {
  if (!objectXml) return

  window.connectableEdges = false;
  window.vertexValue = '';
  window.edgeValue = '';

  var objectNode = mxUtils.parseXml(objectXml).documentElement;
  const sb = this;
  const fns = [];
  const objectList = objectNode.getElementsByTagName('model');
  if (objectList == null || objectList.length === 0) {
    return;
  }
  var field = new mxCell('', new mxGeometry(0, 0, 100, 26), 'text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;html=1;');
  field.vertex = true;
  field.connectable = false;

  var divider = new mxCell('', new mxGeometry(0, 0, 100, 2), 'line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;');
  divider.vertex = true;
  divider.connectable = false;
  // divider.visible = 0;

  function getField(fieldText = '') {
    var field1 = new mxCell(fieldText, new mxGeometry(0, 0, 100, 35), 'text;strokeColor=none;fillColor=none;align=center;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;whiteSpace=wrap;html=1;');
    field1.vertex = true;
    field1.connectable = false;
    return field1;
  }

  for (let i = 0; i < objectList.length; i++) {
    const obj = objectList[i];
    if (obj.children[0].nodeName === 'relaentity' && !window.connectableEdges) {
      window.connectableEdges = true;
    }
    const displayNode = this.getDisplay(obj.children[0].getAttribute('display'));
    const width = displayNode.getAttribute('w');
    const height = displayNode.getAttribute('h');
    let style = displayNode.getAttribute('style');
    const display = displayNode.getAttribute('display');

    // 实体
    if (obj.getAttribute('type') == 'META_ENTITY') {
      window.vertexValue = obj.children[0];
      var objType = "";

      if (display === 'LABEL_INPUT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var edge = new mxCell('', new mxGeometry(0, 0, 40, 40), 'endArrow=none;html=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(70, 100), true);
          edge.geometry.setTerminalPoint(new mxPoint(100, 70), false);
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);

          var text = new mxCell('In', new mxGeometry(0, 0, 30, 20), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;');
          text.vertex = true;
          cell.insert(text);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_DOWN_T') { // 倒T
        fns.push(this.addEntry('', function () {


          const points = []
          Array.from({
            length: 20
          }).forEach((item, index) => {
            points.push([0.3, (index * 0.05).toFixed(1), 0])
          })
          Array.from({
            length: 20
          }).forEach((item, index) => {
            points.push([0.7, (index * 0.05).toFixed(1), 0])
          })
          style += `points=${JSON.stringify(points)};`

          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_HEXAGONAL_RECT_LANE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          const hexagonalStyle = "shape=image;html=1;image=images/六边形.svg;verticalLabelPosition=middle;labelBackgroundColor=none;verticalAlign=middle;imageAspect=1;aspect=fixed;align=center;labelPosition=center;fontColor=#FFFFFF;"
          const hexagonal = new mxCell('', new mxGeometry(0, 0, height / 2, height / 2), hexagonalStyle);
          hexagonal.vertex = true;
          hexagonal.geometry.relative = true;
          hexagonal.geometry.x = 0
          hexagonal.geometry.y = 0
          hexagonal.geometry.offset = new mxPoint(-height / 4, height / 4);

          cell.insert(hexagonal);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_OUTPUT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var edge = new mxCell('', new mxGeometry(0, 0, 40, 40), 'endArrow=none;html=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(100, 30), false);
          edge.geometry.setTerminalPoint(new mxPoint(70, 0), true);
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);

          var text = new mxCell('Out', new mxGeometry(0, 0, 30, 20), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;');
          text.vertex = true;
          cell.insert(text);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_JUMP') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var circle1 = new mxCell('', new mxGeometry(35, 20, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#f8b57e;aspect=fixed;');
          circle1.vertex = true;
          cell.insert(circle1);

          var circle2 = new mxCell('', new mxGeometry(35, 50, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#f8b57e;aspect=fixed;');
          circle2.vertex = true;
          cell.insert(circle2);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_PARALLEL') {
        console.log('并行网关')
        console.log(obj.getAttribute('tooltip'))
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(20, 20, 20, 20), 'shape=umlDestroy;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#33001A;direction=west;rotation=-45;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_USER') {
        console.log('用户任务')
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 0, 14, 14), 'html=1;shape=mxgraph.bpmn.user_task;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'ACTIVITY_COMPENSATION') {
        console.log('补偿活动')
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell2 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=mxgraph.bpmn.compensation;html=1;outlineConnect=0;');
          cell2.vertex = true;
          cell2.geometry.relative = true;
          cell2.geometry.offset = new mxPoint(-7, -14);
          cell.insert(cell2);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'CHOREOGRAPHYTASK_DEFAULT' || display === 'CHOREOGRAPHYTASK_CALL') {
        console.log('编排任务')
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('',
            new mxGeometry(0, 0, 120, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;bottomRightStyle=square;bottomLeftStyle=square;part=1;');
          cell1.vertex = true;
          cell.insert(cell1);

          var cell2 = new mxCell('',
            new mxGeometry(0, 0, 120, 60),
            'shape=mxgraph.bpmn.task;part=1;taskMarker=abstract;connectable=0;whiteSpace=wrap;fillColor=none;');
          cell2.vertex = true;
          cell.insert(cell2);

          var cell3 = new mxCell('',
            new mxGeometry(0, 1, 20, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;topRightStyle=square;topLeftStyle=square;fillColor=#C0C0C0;part=1;');
          cell3.vertex = true;
          cell3.geometry.relative = false;
          cell.insert(cell3);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'CHOREOGRAPHYTASK_SUB' || display === 'CHOREOGRAPHYTASK_CALL_SUB') {
        console.log('子编排任务')
        fns.push(this.addEntry('sub choreography collapsed', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('',
            new mxGeometry(0, 0, 120, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;bottomRightStyle=square;bottomLeftStyle=square;part=1;');
          cell1.vertex = true;
          cell.insert(cell1);

          var cell2 = new mxCell('',
            new mxGeometry(0, 0, 120, 60),
            'shape=mxgraph.bpmn.task;arcSize=0;taskMarker=abstract;part=1;isLoopSub=1;connectable=0;whiteSpace=wrap;fillColor=none;');
          cell2.vertex = true;
          cell.insert(cell2);

          var plus = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;html=1;outlineConnect=0;');
          plus.vertex = true;
          plus.geometry.relative = true;
          plus.geometry.offset = new mxPoint(-7, -14);
          cell2.insert(plus);

          var cell3 = new mxCell('',
            new mxGeometry(0, 1, 20, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;topRightStyle=square;topLeftStyle=square;fillColor=#C0C0C0;part=1;');
          cell3.vertex = true;
          cell3.geometry.relative = false;
          cell.insert(cell3);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'CONVERSATION_SUB' || display === 'CONVERSATION_XIEZUO') {
        console.log('子对话');
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(-7, -14);
          cell.insert(cell1);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_COMPENSATION') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(13, 15, 20, 20), 'shape=mxgraph.bpmn.compensation;html=1;outlineConnect=0;fillColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'DATA_INPUT') {
        console.log('输入数据');
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 0, 14, 14), 'html=1;shape=singleArrow;arrowWidth=0.4;arrowSize=0.4;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(2, 2);
          cell.insert(cell1);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_SIGNAL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=mxgraph.flowchart.extract_or_measurement;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_ERROR') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=tape;whiteSpace=wrap;html=1;fillColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_MULTIPLE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_MESSAGE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 25, 18), 'shape=message;whiteSpace=wrap;html=1;outlineConnect=0;fillColor=#000000;strokeColor=#ffffff;strokeWidth=2;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_END') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(12, 12, 26, 26), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#000000;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_SIGNAL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=mxgraph.flowchart.extract_or_measurement;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'PARTICIPANT_CONVERSATION') {
        fns.push(this.addEntry('sub choreography collapsed', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('',
            new mxGeometry(0, 0, 120, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;bottomRightStyle=square;bottomLeftStyle=square;fillColor=#C0C0C0;part=1;');
          cell1.vertex = true;
          cell.insert(cell1);

          var cell2 = new mxCell('',
            new mxGeometry(0, 0, 120, 80),
            'shape=mxgraph.bpmn.task;arcSize=0;taskMarker=abstract;part=1;isLoopSub=1;connectable=0;whiteSpace=wrap;fillColor=none;');
          cell2.vertex = true;
          cell.insert(cell2);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_MUL_PARALLEL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=cross;whiteSpace=wrap;html=1;align=center;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_MESSAGE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 17, 20, 16), 'html=1;shape=message;outlineConnect=0;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_MESSAGE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 17, 20, 16), 'shape=message;whiteSpace=wrap;html=1;outlineConnect=0;fillColor=#000000;strokeColor=#ffffff;strokeWidth=2;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_COMPENSATION') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(13, 15, 20, 20), 'shape=mxgraph.bpmn.compensation;html=1;outlineConnect=0;fillColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_MULTIPLE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_LINK') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 17.5, 22, 15), 'shape=mxgraph.arrows.arrow_right;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;strokeWidth=2;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_MULTIPLE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_SIGNAL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.flowchart.extract_or_measurement;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_MESSAGE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 17, 20, 16), 'html=1;shape=message;outlineConnect=0;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_MUL_PARALLEL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=cross;whiteSpace=wrap;html=1;align=center;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_TIME') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(7.5, 7.5, 35, 35), 'shape=mxgraph.bpmn.timer_start;html=1;align=center;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_SERVICE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 20, 20), 'shape=mxgraph.bpmn.service_task;html=1;outlineConnect=0;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SUB_PROCESS_BUSINESS') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(-7, -16);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_SCRIPT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 20, 20), 'shape=mxgraph.bpmn.script_task;html=1;outlineConnect=0;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_SEND') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 30, 20), 'shape=message;whiteSpace=wrap;html=1;outlineConnect=0;fillColor=#000000;strokeColor=#ffffff;strokeWidth=2;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SUB_PROCESS_DEFAULT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(-7, -14);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_RULE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 20, 15), 'shape=mxgraph.bpmn.business_rule_task;html=1;outlineConnect=0;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SUB_PROCESS_EVENT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(-7, -14);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_RECV') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 30, 20), 'html=1;shape=message;outlineConnect=0;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_EXCLUSIVE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(27.5, 15, 5, 30), 'rounded=0;whiteSpace=wrap;html=1;fillColor=#000000;rotation=45;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_COMPLEX') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(20, 20, 20, 20), 'shape=umlDestroy;whiteSpace=wrap;html=1;strokeWidth=1;fillColor=#33001A;direction=west;rotation=-45;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          var symbol2 = new mxCell('', new mxGeometry(20, 20, 20, 20), 'shape=umlDestroy;whiteSpace=wrap;html=2;strokeWidth=2;fillColor=#33001A;direction=west;html=1;aspect=fixed;');
          symbol2.vertex = true;
          cell.insert(symbol2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_INSTANCE_PARALLEL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          var symbol2 = new mxCell('', new mxGeometry(20, 20, 20, 20), 'shape=cross;whiteSpace=wrap;html=1;align=center;aspect=fixed;aspect=fixed;');
          symbol2.vertex = true;
          cell.insert(symbol2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_EVENT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(12.5, 12.5, 35, 35), 'ellipse;shape=doubleEllipse;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          var symbol2 = new mxCell('', new mxGeometry(19, 20, 20, 18), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol2.vertex = true;
          cell.insert(symbol2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_INCLUSIVE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_INSTANCE_EVENT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          var symbol2 = new mxCell('', new mxGeometry(19, 20, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol2.vertex = true;
          cell.insert(symbol2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_MULTIPLE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_LINK') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 17.5, 22, 15), 'shape=mxgraph.arrows.arrow_right;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_SIGNAL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=mxgraph.flowchart.extract_or_measurement;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      }

      // hmx-add 添加建模元素实体
      else if (display === 'UML_SHEJILEI') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;');
          cell.vertex = true;
          cell.insert(sb.cloneCell(field, '+ field: Type'));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, '+ method(type): type'));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_INTERFACE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 120),
            'swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;');
          cell.vertex = true;
          cell.selectabled = false
          cell.insert(sb.cloneCell(field, '+ field: Type'));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, '+ method(type): type'));

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_QISHIDIAN') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 10), 'ellipse;html=1;aspect=fixed;fillColor=#000000;align=center;verticalAlign=top;rounded=0;labelPosition=center;verticalLabelPosition=bottom;');
          cell.vertex = true;
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(5, 10), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(5, 40), false); //end
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DUIXIANGSHILI') {
        fns.push(this.addEntry('', function () {
          return sb.createVertexTemplateFromCells([sb.cloneCell(field, '+ item: attribute')], field.geometry.width, field.geometry.height, '对象实例');
        }));
      } else if (display === 'UML_YEWUSHITI') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(26, -7, 59, 124), 'line;strokeWidth=1;html=1;direction=west;rotation=314;aspect=fixed;');
          cell1.vertex = true;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_CHUSHIZHUANGTAI') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 10), 'ellipse;html=1;aspect=fixed;fillColor=#000000;align=center;verticalAlign=top;rounded=0;labelPosition=center;verticalLabelPosition=bottom;');
          cell.vertex = true;
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(5, 10), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(5, 40), false); //end
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_FUHEZHUANGTAI') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell('', new mxGeometry(0, 0, 120, 60), 'html=1;whiteSpace=wrap;rounded=1;dropTarget=0;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 0, 40, 20), 'rounded=1;whiteSpace=wrap;html=1;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(70, 30);
          cell.insert(cell1);

          var cell2 = new mxCell('', new mxGeometry(0, 0, 40, 20), 'rounded=1;whiteSpace=wrap;html=1;');
          cell2.vertex = true;
          cell2.geometry.relative = true;
          cell2.geometry.offset = new mxPoint(12, 12);
          cell.insert(cell2);

          var cell3 = new mxCell('', new mxGeometry(0, 0, 20, 10), 'line;strokeWidth=1;html=1;direction=west;rotation=0;');
          cell3.vertex = true;
          cell3.geometry.relative = true;
          cell3.geometry.offset = new mxPoint(50, 27);
          cell.insert(cell3);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '复合状态');
        }));
      } else if (display === 'UML_DFD_WBX') { //外部项
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 0, 40, 56), 'shape=partialRectangle;whiteSpace=wrap;html=1;bottom=0;right=0;fillColor=none;');
          cell1.vertex = true;
          cell1.connectable = false;
          var cell2 = new mxCell('', new mxGeometry(6, 6, 68, 88), 'rounded=0;whiteSpace=wrap;html=1;fillColor=none;');
          cell2.vertex = true;
          cell2.connectable = false;
          cell.insert(cell1);
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DFD_SJJG') { //数据加工
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 70),
            'rounded=0;whiteSpace=wrap;html=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DFD_SJCC') { //数据存储
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 140, 46),
            'shape=partialRectangle;whiteSpace=wrap;html=1;bottom=1;right=1;left=1;top=0;fillColor=none;routingCenterX=-0.5;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;direction=south;');
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 3, 46, 40), 'line;strokeWidth=1;html=1;direction=west;rotation=-90;');
          cell1.vertex = true;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_ER_RGX') { //弱关系
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 6, 140, 72), 'html=1;whiteSpace=wrap;aspect=fixed;shape=isoRectangle;fillColor=none;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_ER_GH') { //概化
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 60), 'triangle;whiteSpace=wrap;html=1;direction=south;');
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(35, -24, 30, 24), 'line;strokeWidth=1;direction=south;html=1;');
          cell1.vertex = true;
          cell.insert(cell1);
          var cell2 = new mxCell('', new mxGeometry(27.5, 60, 45, 60), 'line;strokeWidth=1;direction=south;html=1;');
          cell2.vertex = true;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_ER_QBGH') { //全部概化
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 60), 'triangle;whiteSpace=wrap;html=1;direction=south;');
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(35, -24, 30, 24), 'shape=partialRectangle;whiteSpace=wrap;html=1;top=0;bottom=0;fillColor=none;');
          cell1.vertex = true;
          cell.insert(cell1);
          var cell2 = new mxCell('', new mxGeometry(25, 60, 45, 60), 'line;strokeWidth=1;direction=south;html=1;');
          cell2.vertex = true;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DEPLOYMENT_NODE') { //节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 150, 130),
            'verticalAlign=top;align=left;spacingTop=8;spacingLeft=2;spacingRight=12;shape=cube;size=10;direction=south;fontStyle=0;html=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DEPLOYMENT_DEPLOYMEN') { //配置图 组件
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 80), 'html=1;whiteSpace=wrap;dropTarget=0;aspect=fixed;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(-10, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);

          var cell2 = new mxCell('', new mxGeometry(-10, 50, 20, 15), 'whiteSpace=wrap;html=1;fontSize=17;aspect=fixed;');
          cell2.vertex = true;
          cell2.connectable = false;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_COMPONENT_COMPONENT') { //组件图 组件
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 80), 'html=1;whiteSpace=wrap;dropTarget=0;aspect=fixed;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(-10, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);

          var cell2 = new mxCell('', new mxGeometry(-10, 50, 20, 15), 'whiteSpace=wrap;html=1;fontSize=17;aspect=fixed;');
          cell2.vertex = true;
          cell2.connectable = false;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_COMPONENT_INTERFACE') { //接口
        var className = obj.children[0].getAttribute('name');
        var objName = className;
        if (obj.getAttribute('class_flag') == '1') {
          objName = className + "的实例";
        }
        style = 'shape=rect;html=1;overflow=fill;whiteSpace=wrap;align=center;';
        var label = '<div style="width: 100%;"><p style="background-color: rgb(218 , 232 , 252);padding:5px 0 7px 0;margin:0px;text-align:center;">' +
          '&lt;&lt;' + className + '&gt;&gt;<br style="margin-top:0px;/>' +
          '<b>' + objName + '</b></p><hr/>' +
          '<p style="margin:0px;margin-left:8px;text-align:left;">' +
          '名称="' + objName + '..."</p></div>';
        // var label = '<p style="margin:0px;margin-top:4px;text-align:center;">' +
        //   '&lt;&lt;' + className + '&gt;&gt;<br/>' +
        //   '<b>' + objName + '</b></p><hr/>' +
        //   '<p style="margin:0px;margin-left:8px;text-align:left;">' +
        //   '名称="' + objName + '..."</p>';
        obj.children[0].setAttribute("label", label);
        objType = "sysMLRectangle";
        if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
          style += 'container=1;';
        }
        fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));

      } else if (display === 'UML_COMPONENT_PORT') { //端口
        fns.push(this.addEntry('', function () { //小方块栓
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 10),
            'rounded=0;html=1;verticalAlign=top;align=center;labelPosition=center;verticalLabelPosition=bottom;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_PACKAGE') { //包
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 90, 60),
            'shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=15;tabPosition=left;html=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_COMPONENT_ARTIFACT') { //制品
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 140, 105),
            'swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=0;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;align=center;');
          cell.vertex = true;
          cell.insert(getField("&lt;&lt;artifact&gt;&gt;"));
          var divider1 = new mxCell('', new mxGeometry(0, 0, 0, 1), 'line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;');
          divider1.vertex = true;
          divider1.connectable = false;
          cell.insert(divider1.clone());
          cell.insert(getField(''));
          cell.insert(divider1.clone());
          cell.insert(getField(''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_DENGDAISHIJIANDONGZUO') { // 等待时间动作
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, width, height),
            'html=1;shape=mxgraph.sysml.timeEvent;strokeWidth=2;verticalLabelPosition=bottom;verticalAlignment=top;');
          cell.vertex = true;
          cell.value.setAttribute('label', '');
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_KUAIJIEDIAN') { //块节点
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          let type = 'block'
          style = 'html=1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;gradientDirection:west;verticalAlign=top;align=left;container=1;';

          var label = '<div style="width: 100%;"><p style="padding:5px 0 7px 0;margin:0px;text-align:center;">' +
            '&lt;&lt;' + type + '&gt;&gt;<br style="margin-top:0px;/>' +
            '/p><hr/>' + '<p style="margin:0px;margin-left:8px;text-align:left; font-weight: 700">' + className + '</p></div>';
          obj.children[0].setAttribute("label", label);

          objType = "sysMLRectangle";
          if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
            style += 'container=1;';
          }
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style, objType);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 130, 110)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_BUJIAN') { //部件
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          var label = `<div style="box-sizing: border-box;width: 100%;height:40px;line-height: 40px;"><div style="margin: 0px ; text-align: center"><b style="font-weight: 700">${className}</b></div></div>`

          obj.children[0].setAttribute("label", label);

          objType = "sysMLRectangle";
          style = 'html=1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;gradientDirection:west;verticalAlign=top;align=left;container=1;';

          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style, objType);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 130, 78)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_ZHIJIEDIAN') { //值类型节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;valueType&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_ENUMJIEDIAN') { //枚举节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;enumeration&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_INTERFACEKUAIJIEDIAN') { //接口块节点
        if (obj.getAttribute('sysMLRectangle') == '1' && display != 'LABEL_TIME_BUSINESS') {
          var className = obj.children[0].getAttribute('name');
          var objName = className;
          if (obj.getAttribute('class_flag') == '1') {
            objName = className + "的实例";
          }
          style = 'shape=rect;html=1;overflow=fill;whiteSpace=wrap;align=center;';
          var label = '<p style="margin:0px;margin-top:4px;text-align:center;">' +
            '&lt;&lt;' + className + '&gt;&gt;<br/>' +
            '<b>' + objName + '</b></p><hr/>' +
            '<p style="margin:0px;margin-left:8px;text-align:left;">' +
            '名称="' + objName + '..."</p>';
          obj.children[0].setAttribute("label", label);
          objType = "sysMLRectangle";
          fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
        if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
          style += 'container=1;'
        }
        fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_BLOCKDEFINITION_INTERFACEJIEDIAN') { //接口节点

        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40), 'html=1;whiteSpace=wrap;dropTarget=0;aspect=fixed;gradientDirection:west;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(83, 3, 12, 12), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;shadow=0;opacity=80;part=1;resizable=0;editable=0;cloneable=0;gradientDirection:west;rotatable=0;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));

      } else if (display === 'SYSML_BLOCKDEFINITION_XINHAOJIEDIAN') { //信号节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          var text = new mxCell('&lt;&lt;interface&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.vertex = true;
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_KUAIJIEKOUFENQU') { //块节点的接口分区
        if (obj.getAttribute('sysMLRectangle') == '1' && display != 'LABEL_TIME_BUSINESS') {
          var className = obj.children[0].getAttribute('name');
          var objName = className;
          if (obj.getAttribute('class_flag') == '1') {
            objName = className + "的实例";
          }
          style = 'shape=rect;html=1;overflow=fill;whiteSpace=wrap;align=center;';
          var label = '<p style="margin:0px;margin-top:4px;text-align:center;">' +
            '&lt;&lt;' + className + '&gt;&gt;<br/>' +
            '<b>' + objName + '</b></p><hr/>' +
            '<p style="margin:0px;margin-left:8px;text-align:left;">' +
            '名称="' + objName + '..."</p>';
          obj.children[0].setAttribute("label", label);
          objType = "sysMLRectangle";
          fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
        if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
          style += 'container=1;'
        }
        fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'LABEL_INPUTPIN') { //入栓

        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=mxgraph.sysml.inputPin;points=[[0,0.5,0]];html=1;resizable=1;align=right;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'LABEL_OUTPIN') { //入栓

        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=mxgraph.sysml.outPin;points=[[0,0.5,0]];html=1;resizable=1;align=right;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_BLOCKDEFINITION_WANZHENGPORTJIEDIAN') { //完整端口节点
        // let label = obj.children[0].getAttribute("label");
        // obj.children[0].setAttribute("label", "&lt;&lt;full&gt;&gt;\n" +label);
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;gradientColor=#fff;gradientDirection:west;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_BLOCKDEFINITION_DAILIPORTJIEDIAN') { //代理端口节点
        // let label = obj.children[0].getAttribute("label");
        // obj.children[0].setAttribute("label", "&lt;&lt;proxy&gt;&gt;\n" +label);
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;gradientColor=#fff;gradientDirection:west;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_INTERNALMODULE_PORTJIEDIAN') { //端口节点
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_INTERNALMODULE_LIUPORTJIEDIAN') { //流端口节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 20, 20),
            'strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;');
          var edgeLeft = new mxCell('', new mxGeometry(0, 0, 0, 0), 'endArrow=open;html=1;shadow=0;strokeColor=#000000;strokeWidth=1;endFill=0;fontSize=1;spacing=0;jumpSize=0;jumpStyle=arc;startSize=0;endSize=3;movable=0');
          edgeLeft.edge = true;
          edgeLeft.geometry.setTerminalPoint(new mxPoint(7, 10), true);
          edgeLeft.geometry.setTerminalPoint(new mxPoint(0, 10), false);
          edgeLeft.geometry.relative = true;

          var edgeRight = new mxCell('', new mxGeometry(0, 0, 0, 0), 'endArrow=open;html=1;shadow=0;strokeColor=#000000;strokeWidth=1;endFill=0;fontSize=1;spacing=0;jumpSize=0;jumpStyle=arc;startSize=0;endSize=3;movable=0');
          edgeRight.edge = true;
          edgeRight.geometry.setTerminalPoint(new mxPoint(13, 10), true);
          edgeRight.geometry.setTerminalPoint(new mxPoint(20, 10), false);
          edgeRight.geometry.relative = true;
          cell.insert(edgeLeft);
          cell.insert(edgeRight);
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_INTERNALMODULE_WANZHENGPORTJIEDIAN') { //完整端口节点
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0],[0.5,0,0],[0.5,0.5,0],[0.5,1,0]];html=1;resizable=1;align=right;gradientColor=#fff;gradientDirection:west;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_INTERNALMODULE_DAILIPORTJIEDIAN') { //代理端口节点
        // let label = obj.children[0].getAttribute("label");
        // obj.children[0].setAttribute("label", "&lt;&lt;full&gt;&gt;\n" +label);
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_BLOCKDEFINITION_DAIJIEKOUDAILIPORTJIEDIAN') { //带接口的代理端口节点
        obj.children[0].setAttribute("label", "");
        fns.push(this.createVertexTemplateEntry(style, parseInt(30), parseInt(30), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_BLOCKDEFINITION_DAIYUESUFENQUKUAIJIEDIAN') { //带约束分区的块节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;block&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_YUESUKUAIJIEDIAN') { //约束块节点
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');

          var label = '<div style="width: 100%;"><p style="padding:5px 0 7px 0;margin:0px;text-align:center;">' +
            '&lt;&lt;' + 'block' + '&gt;&gt;<br style="margin-top:0px;/>' +
            '/p><hr/>' + '<p style="margin:0px;margin-left:8px;text-align:left; font-weight: 700">' + className + '</p></div>';
          obj.children[0].setAttribute("label", label);

          objType = "sysMLRectangle";
          style = 'html=1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;verticalAlign=top;align=left;container=1;container=1;gradientColor=#fff;';

          if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
            style += 'container=1;';
          }
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style, objType);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 130, 78)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));

      } else if (display === 'SYSML_BLOCKDEFINITION_HUODONGJIEDIAN') { //活动节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;activity&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_SHILIGUIFANJIEDIAN') { //实例规范节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;');
          cell.vertex = true;
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_SHULIANGZHONGLEIJIEDIAN') { //数量种类节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;');
          cell.vertex = true;
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_DANWEIJIEDIAN') { //单位节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;');
          cell.vertex = true;
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_COMMENT') { //注释说明
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_YUANSUZU') { //元素组
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 80),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;elementGroup&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_BAOJIEDIAN') { //包节点

        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 90, 60),
            'shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=15;tabPosition=left;html=1;container=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_MODELBAOJIEDIAN') { //模块包节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 90, 60),
            'html=1;shape=mxgraph.sysml.composite;symbol0=folder;fontStyle=0;spacingTop=15;tabWidth=80;tabHeight=20;tabPosition=left;symbol1=triangle;symbol1Width=7;symbol1Height=10;symbol1Align=right;symbol1VerticalAlign=top;symbol1Spacing=8;symbol1VSpacing=25;symbol1Direction=north;strokeWidth=1;whiteSpace=wrap;align=center;container=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_MODELJIEDIAN') { //模型节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 60),
            'shape=folder;fontStyle=1;spacingTop=10;tabWidth=60;tabHeight=30;tabPosition=left;html=1;align=left;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_KEFENGZHUANGBAOJIEDIAN') { //可封装元素节点

        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 60),
            'html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;ElementKind&gt;&gt;', new mxGeometry(0, 0, 100, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_INTERNALMODULE_ZUCHENGJIEDIAN') { //组成节点
        fns.push(this.addEntry('', function () { //内部小模块
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 80, 80),
            'whiteSpace=wrap;html=1;verticalAlign=top;fontStyle=1');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_INTERNALMODULE_YINYONGJIEDIAN') { //引用节点
        // fns.push(this.addEntry('', function () {
        //   var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
        //     'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;dashed=1;');
        //   cell.vertex = true;

        //   var cell1 = new mxCell('', new mxGeometry(0, 0, 100, 30), 'html=1;aspect=fixed;');
        //   cell1.vertex = true;
        //   cell.insert(cell1);
        //   return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        // }));
        fns.push(this.addEntry('', function () { //小方块栓
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 10),
            'rounded=0;html=1;verticalAlign=middle;align=center;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_INTERNALMODULE_CANYUSHUXINGJIEDIAN') { //参与属性节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 70),
            'html=1;aspect=fixed;dashed=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;participant&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_INTERNALMODULE_BANGDINGYINYONGJIEDIAN') { //绑定引用节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 40),
            'html=1;aspect=fixed;dashed=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;boundReference&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_INTERNALMODULE_ZHISHUXINGJIEDIAN') { //值属性节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;');
          cell.vertex = true;
          cell.insert(field.clone());
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PARAMETRIC_YUESHUJIEDIAN') { //约束节点
        fns.push(this.addEntry('', function () { //部件
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 140, 80),
            'whiteSpace=wrap;html=1;verticalAlign=top;');
          cell.vertex = true;

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PARAMETRIC_YUESHUCANSHUJIEDIAN') { //约束参数节点
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;gradientColor=#fff;gradientDirection:west;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_PARAMETRIC_YUESHUSHUXINGJIEDIAN') { //约束属性节点
        // var className = obj.children[0].getAttribute('name');
        // var objName = className;
        // if (obj.getAttribute('class_flag') == '1') {
        //   objName = className + "的实例";
        // }
        // style = 'html=1;shape=mxgraph.sysml.port1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;verticalAlign=top;align=left;container=1;';
        // var label = '<div style="padding:0 20px "><p style="margin:0px;margin-top:4px;text-align:center;">' +
        //   '&lt;&lt;' + className + '&gt;&gt;<br/>' +
        //   '<b>' + objName + '</b></p><hr/>' +
        //   '<p style="margin:0px;margin-left:8px;text-align:left;">' +
        //   '名称="' + objName + '..."</p></div>';
        // obj.children[0].setAttribute("label", label);
        // objType = "sysMLRectangle";
        // fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        fns.push(this.addEntry('', function () { //Attribute
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, width, height),
            'rounded=1;whiteSpace=wrap;html=1;gradientColor=#ffffff;gradientDirection=east;strokeColor=#CCCCCC;fillColor=#fff;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_HUODONGCANSHUJIEDIAN') { //活动参数节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 90, 30), 'shape=rect;whiteSpace=wrap;html=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_HUODONGFENQUJIEDIAN') { //活动分区节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 40),
            'rounded=0;whiteSpace=wrap;html=1;');
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 40, 160, 0), 'shape=mxgraph.flowchart.annotation_1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;direction=south;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JIEGOUHUAHUODONGJIEDIAN') { //结构化活动节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40),
            'rounded=1;html=1;dashed=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;constraint&gt;&gt;', new mxGeometry(0, 0, 100, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_CHUSHIJIEDIAN') { //初始节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 40, 40), 'noLabel=1;ellipse;html=1;aspect=fixed;fillColor=#000000;align=center;verticalAlign=top;rounded=0;labelPosition=center;verticalLabelPosition=bottom;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JUECESHURUXINGWEIJIEDIAN') { //决策输入行为节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 50), 'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;decisionInput&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          var cell1 = new mxCell('', new mxGeometry(160, 60, 40, 40), 'rhombus;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell1.vertex = true;
          // cell1.connectable = false;
          cell.insert(cell1);


          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=none;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(160, 80), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(80, 50), false); //end
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_DIAOYONGDONGZUOJIEDIAN') { //调用动作节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 50), 'shape=rect;html=1;rounded=1;whiteSpace=wrap;arcSize=15;dropTarget=0;aspect=fixed;');
          cell.vertex = true;

          var cell1 = new mxCell('→', new mxGeometry(-10, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;connectable=0;movable=0;rotatable=0;');
          cell1.vertex = true;
          cell.insert(cell1);

          var cell2 = new mxCell('→', new mxGeometry(150, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;connectable=0;movable=0;rotatable=0;');
          cell2.vertex = true;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_ZHONGYANGHUANCHONGQUJIEDIAN') { //中央缓冲区节点
        fns.push(this.addEntry('', function () { //小方块栓
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 10),
            'rounded=0;html=1;verticalAlign=middle;align=center;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_SHUJUCUNCHUJIEDIAN') { //数据存储节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 130, 60),
            'html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;dataStore&gt;&gt;', new mxGeometry(0, 0, 130, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_KONGZHICAOZUOFUDONGZUOJIEDIAN') { //控制操作符动作节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 50), 'html=1;rounded=1;whiteSpace=wrap;dropTarget=0;aspect=fixed;');
          cell.vertex = true;
          var cell1 = new mxCell('→', new mxGeometry(-10, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);

          var cell2 = new mxCell('→', new mxGeometry(150, 15, 20, 15), 'whiteSpace=wrap;html=1;fontSize=17;aspect=fixed;');
          cell2.vertex = true;
          cell2.connectable = false;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JIESHOUSHIJIANDONGZUOJIEDIAN') { //接收事件动作节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 35), 'html=1;shape=mxgraph.sysml.accEvent;strokeWidth=1;whiteSpace=wrap;align=center;');
          cell.vertex = true;
          // var cell1 = new mxCell('', new mxGeometry(0, 0, 30, 35), 'shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#000000;size=50;direction=west;flipH=1;strokeWidth=1;aspect=fixed;');
          // cell1.vertex = true;
          // cell1.connectable = false;
          // cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_HUODONGJIESHUJIEDIAN') { //活动结束节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 40, 40), 'noLabel=1;ellipse;html=1;shape=endState;fillColor=#000000;strokeColor=#000000;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_FENZHIJIEDIAN') { //分支节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 5, 160), 'rounded=1;html=1;fillColor=#000000;direction=south;strokeWidth=1;perimeterSpacing=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          // var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=10;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=0;aspect=fixed;');
          // edge.geometry.setTerminalPoint(new mxPoint(-50, 35), true);  //start
          // edge.geometry.setTerminalPoint(new mxPoint(0, 35), false);  //end
          // edge.geometry.relative = true;
          // edge.edge = true;
          // cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_YHUIHEJIEDIAN') { //汇合节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 5), 'rounded=1;html=1;fillColor=#000000;direction=south;strokeWidth=1;perimeterSpacing=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JUECEJIEDIAN') { //决策节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 30, 30), 'rhombus;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;align=center;verticalAlign=middle;rounded=0;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JIESHOUSHIJIANSHIJIANJIEDIAN') { //接收时间事件节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 50, 50), 'shape=collate;whiteSpace=wrap;html=1;strokeColor=#000000;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_FASONGXINHAODONGZUO') { //发送信号动作
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 35), 'html=1;shape=mxgraph.sysml.sendSigAct;strokeWidth=1;whiteSpace=wrap;align=center;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_OBJECTNODE') { //对象节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 70, 35), 'rounded=0;whiteSpace=wrap;html=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JIBENDONGZUOJIEDIAN') { //基本动作节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 60), 'shape=rect;html=1;rounded=1;whiteSpace=wrap;align=center;arcSize=15;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_DANYIFENQUPIANDUANJIEDIAN') { //单一分区片段节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'shape=umlFrame;whiteSpace=wrap;html=1;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(115, 20, 20, 60), 'rounded=0;html=1;labelBackgroundColor=none;labelBorderColor=none;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_DUOFENQUPIANDUANJIEDIAN') { //多分区片段节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'html=1;connectable=0;shape=mxgraph.sysml.package;labelX=40;whiteSpace=wrap;align=center;strokeWidth=1;');
          cell.vertex = true;

          const ref = new mxCell('par', new mxGeometry(0, 0), 'html=1;resizable=0;movable=0;connectable=0;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
          ref.vertex = true
          ref.geometry.offset = new mxPoint(5, 0);
          ref.geometry.relative = true
          ref.connectable = '0'
          cell.insert(ref);

          var text1 = new mxCell('[]', new mxGeometry(0, 0, 170, 20), 'text;autosize=1;autosizeHeight=1;resizable=1;movable=0;connectable=0;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text1.geometry.offset = new mxPoint(5, 30)
          text1.vertex = true
          text1.geometry.relative = true;
          cell.insert(text1)

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_GUOLVPIANDUANJIEDIAN') { //过滤片段节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 160), 'shape=umlFrame;connectable=0;whiteSpace=wrap;html=1;noLabel=1;');
          cell.value.setAttribute('label', '')
          const title = new mxCell('alt', new mxGeometry(0, 0), 'html=1;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
          title.vertex = true
          title.geometry.offset = new mxPoint(5, 0);
          title.geometry.relative = true
          title.connectable = '0'
          cell.insert(title);
          cell.vertex = true;

          var text1 = new mxCell('if', new mxGeometry(0, 0, 170, 20), 'text;autosize=1;resizable=0;movable=0;connectable=0;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text1.geometry.offset = new mxPoint(5, 30)
          text1.vertex = true
          text1.geometry.relative = true;

          // var text1 = new mxCell('if', new mxGeometry(0, 0, 0, 0), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;');
          // text1.geometry.setTerminalPoint(new mxPoint(180, 20), true); //start
          // text1.geometry.setTerminalPoint(new mxPoint(0, 20), false); //end
          // text1.edge = true;
          // text1.geometry.relative = true;
          cell.insert(text1)

          var text2 = new mxCell('else', new mxGeometry(0, 0, 170, 20), 'text;html=1;autosize=1;resizable=0;movable=0;connectable=0;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text2.geometry.offset = new mxPoint(5, 90)
          text2.vertex = true
          text2.geometry.relative = true;
          // var text2 = new mxCell('else', new mxGeometry(0, 0, 0, 0), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;');
          // text2.geometry.setTerminalPoint(new mxPoint(180, 100), true);
          // text2.geometry.setTerminalPoint(new mxPoint(0, 100), false);
          // text2.edge = true;
          // text2.geometry.relative = true;
          cell.insert(text2)

          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalOnly=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=none;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(180, 80), true);
          edge.geometry.setTerminalPoint(new mxPoint(0, 80), false);
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          edge.extraInfo = {
            isLine: true
          }
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_OPT') { //Opt节点
        fns.push(this.addEntry('', function () {
          // var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'shape=umlFrame;whiteSpace=wrap;html=1;');
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'html=1;connectable=0;shape=mxgraph.sysml.package;labelX=40;;whiteSpace=wrap;align=center;strokeWidth=1;');
          cell.vertex = true;

          const ref = new mxCell('Opt', new mxGeometry(0, 0), 'html=1;resizable=0;movable=0;connectable=0;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
          ref.vertex = true
          ref.geometry.offset = new mxPoint(5, 0);
          ref.geometry.relative = true
          ref.connectable = '0'
          cell.insert(ref);

          var text1 = new mxCell('[]', new mxGeometry(0, 0, 170, 20), 'text;autosize=1;autosizeHeight=1;resizable=1;movable=0;connectable=0;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text1.geometry.offset = new mxPoint(5, 30)
          text1.vertex = true
          text1.geometry.relative = true;
          cell.insert(text1)

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_JIAOHUSHIYONGJIEDIAN') { //交互使用节点
        fns.push(this.addEntry('', function () {
          // verticalOnly=1
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'html=1;connectable=0;shape=mxgraph.sysml.package;labelX=40;;whiteSpace=wrap;align=center;strokeWidth=1;');
          cell.vertex = true;

          const ref = new mxCell('ref', new mxGeometry(0, 0), 'html=1;resizable=0;movable=0;connectable=0;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
          ref.vertex = true
          ref.geometry.offset = new mxPoint(5, 0);
          ref.geometry.relative = true
          ref.connectable = '0'
          cell.insert(ref);

          var text1 = new mxCell('[]', new mxGeometry(0, 0, 170, 20), 'text;autosize=1;autosizeHeight=1;resizable=1;movable=0;connectable=0;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text1.geometry.offset = new mxPoint(5, 30)
          text1.vertex = true
          text1.geometry.relative = true;
          cell.insert(text1)

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_LOOPXUNHUAN') { //loop循环
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'html=1;connectable=0;shape=mxgraph.sysml.package;labelX=40;whiteSpace=wrap;align=center;strokeWidth=1;');
          cell.vertex = true;

          const ref = new mxCell('loop', new mxGeometry(0, 0), 'html=1;resizable=0;movable=0;connectable=0;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
          ref.vertex = true
          ref.geometry.offset = new mxPoint(5, 0);
          ref.geometry.relative = true
          ref.connectable = '0'
          cell.insert(ref);

          var text1 = new mxCell('[]', new mxGeometry(0, 0, 170, 20), 'text;autosize=1;autosizeHeight=1;resizable=1;movable=0;connectable=0;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text1.geometry.offset = new mxPoint(5, 30)
          text1.vertex = true
          text1.geometry.relative = true;
          cell.insert(text1)

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_BIANJIE') { //时序图边界
        fns.push(this.addEntry(obj.children[0], function () {
          // var cell = new mxCell('', new mxGeometry(0, 0, 130, 300), 'group');
          // cell.vertex = true;
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 40, 100, 300), 'shape=umlLifeline;perimeter=lifelinePerimeter;verticalLabelPosition=middle;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;');
          // cell2.geometry.offset = new mxPoint(8, 30);
          // cell2.geometry.relative = true;
          // cell2.parent = cell;
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 0, 40, 30), 'shape=umlActor;labelBackgroundColor=#ffffff;verticalAlign=top;html=1;outlineConnect=1;part=1;');
          cell1.geometry.offset = new mxPoint(30, -35);
          cell1.geometry.relative = true;
          // cell1.parent = cell;
          cell1.connectable = false;
          cell1.vertex = true;
          // cell.insert(cell1);
          // cell.insert(cell2);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_JIHUOJIEDIAN') { //激活节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 100), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_XIEZUOQUYUBIAOSHI') { //协作区域标识
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 20, 25), 'shape=mxgraph.flowchart.annotation_1;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;direction=south;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;');
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 50, 20, 25), 'shape=mxgraph.flowchart.annotation_1;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;direction=north;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_CHIXUQIGUANCHABIAOJI') { //持续期观察标记
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 100), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_CHIXUQIYUESHUBIAOSHI') { //持续期约束标识
        fns.push(this.addEntry('', function () {
          var edge = new mxCell(obj.children[0], new mxGeometry(0, 0, 0, 0),
            'endArrow=open;endFill=0;endSize=14;html=1;startArrow=open;startFill=0;rounded=0;labelBorderColor=none;labelBackgroundColor=none;');
          edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
          edge.geometry.setTerminalPoint(new mxPoint(0, 100), false);
          edge.geometry.relative = true;
          edge.edge = true;
          // var text = new mxCell('&lt;&lt;number&gt;&gt;min', new mxGeometry(-0.5, 10, 60, 10), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;');
          // text.vertex = true;
          // text.geometry.relative = true;
          return sb.createEdgeTemplateFromCells([edge], 0, 100, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_SHIKEGUANCHABIAOSHI') { //时刻观察标识
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 100), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_SHIKEYUESHUBIAOSHI') { //时刻约束标识
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 100), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_CSWZTJD') { //初始伪状态节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 25, 25), 'noLabel=1;ellipse;html=1;shape=startState;fillColor=#000000;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          // var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;dashed=1;rounded=1;aspect=fixed;');
          // edge.geometry.setTerminalPoint(new mxPoint(5, 10), true); //start
          // edge.geometry.setTerminalPoint(new mxPoint(5, 40), false); //end
          // edge.geometry.relative = true;
          // edge.edge = true;
          // cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_ZHUANGTAIZHUANHUAN') { //状态转换
        fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;rounded=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '状态转换'));
      } else if (display === 'SYSML_STATEMACHINE_YZZTJD') { //原子状态节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 110, 60), 'html=1;rounded=1;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_ZHUANGTAI') { //状态
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, width, height), 'shape=rect;arcSize=7;rounded=1;html=1;overflow=fill;whiteSpace=wrap;align=center;container=1;');
          var label = `<div style="width: 100%;height:40px"><div style="line-height: 40px;margin: 0px ; text-align: center"><b style="font-weight: 700">${cell.value.getAttribute('name')}</b></div></div><hr style="width:100%;margin-top:0px;" />`;
          obj.children[0].setAttribute("label", label);
          cell.vertex = true;
          // cell.geometry.alternateBounds = new mxRectangle(0, 0, 180, 160)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_XZWZTJD') { //选择伪状态节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 30, 30), 'rhombus;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;align=center;verticalAlign=middle;rounded=0;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_HHWZTJD') { //汇合伪状态节点
        fns.push(this.addEntry('', function () {
          // var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 5, 70), 'rounded=1;html=1;fillColor=#000000;direction=south;strokeWidth=1;perimeterSpacing=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          // cell.vertex = true;
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 30, 30), 'rhombus;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;align=center;verticalAlign=middle;rounded=0;');
          cell.vertex = true;
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(30, 15), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(50, 15), false); //end
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_FSXHJD') { //发送信号节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 140, 35), 'html=1;shape=mxgraph.sysml.sendSigAct;strokeWidth=1;whiteSpace=wrap;align=center;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
        // fns.push(this.createEdgeTemplateEntry('html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;rounded=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '发送信号节点'));
      } else if (display === 'SYSML_STATEMACHINE_CFJD') { //触发节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 140, 35), 'html=1;shape=mxgraph.sysml.accEvent;strokeWidth=1;whiteSpace=wrap;align=center;');
          cell.vertex = true;
          // var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 35), 'shape=mxgraph.flowchart.annotation_1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;flipH=1;aspect=fixed;');
          // cell.vertex = true;
          // var cell1 = new mxCell('', new mxGeometry(0, 0, 30, 35), 'shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#000000;size=50;direction=west;flipH=1;strokeWidth=1;aspect=fixed;');
          // cell1.vertex = true;
          // cell1.connectable = false;
          // cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_FZWZTJD') { //分支伪状态节点
        fns.push(this.addEntry('', function () {
          // var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 5, 70), 'rounded=1;html=1;fillColor=#000000;direction=south;strokeWidth=1;perimeterSpacing=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          // cell.vertex = true;
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 30, 30), 'rhombus;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;align=center;verticalAlign=middle;rounded=0;');
          cell.vertex = true;
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(0, 15), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(-20, 15), false); //end
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_USECASE_YLJD') { //用例节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 110, 60), 'ellipse;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=middle;');
          cell.vertex = true;
          // var edge3 = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=none;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;aspect=fixed;');
          // edge3.geometry.setTerminalPoint(new mxPoint(18, 20), true);  //start
          // edge3.geometry.setTerminalPoint(new mxPoint(172, 20), false);  //end
          // edge3.geometry.relative = true;
          // edge3.edge = true;
          // cell.insert(edge3);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_USECASE_ZTJD') { //主体节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 400, 300), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;');
          cell.vertex = true;
          // var cell1 = new mxCell('', new mxGeometry(50, 30, 80,30),'ellipse;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=top;');
          // cell1.vertex = true;
          // cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_XQJD') { //需求节点
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          let type = 'block'
          style = 'html=1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;gradientDirection:west;verticalAlign=top;align=left;container=1;';

          var label = '<div style="width: 100%;"><p style="padding:5px 0 7px 0;margin:0px;text-align:center;">' +
            '&lt;&lt;' + type + '&gt;&gt;<br style="margin-top:0px;/>' +
            '/p><hr/>' + '<p style="margin:0px;margin-left:8px;text-align:left; font-weight: 700">' + className + '</p></div>';
          obj.children[0].setAttribute("label", label);
          objType = "sysMLRectangle";
          if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
            style += 'container=1;';
          }
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style, objType);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 150, 40)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_RECTANGLE') { //流程规范
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          let type = '';
          style = 'html=1;fontStyle=1;whiteSpace=wrap;verticalAlign=middle;align=center;container=1;';
          var label = '<div style="width: 100%;"><p style="padding:5px 0 7px 0;margin:0px;text-align:center;">' +
            '&lt;&lt;' + type + '&gt;&gt;<br style="margin-top:0px;/>' +
            '/p><hr/>' + '<p style="margin:0px;margin-left:8px;text-align:left; font-weight: 700">' + className + '</p></div>';
          obj.children[0].setAttribute("label", label);
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 150, 40)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_XQGLLXJD') { //需求关联类型节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;ElementType&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_ZSFQ') { //追溯分区
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40), 'rounded=0;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_CSYLJD') { //测试用例节点
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          let type = 'block'
          style = 'ellipse;whiteSpace=wrap;html=1;fontStyle=1;gradientDirection:west;labelPosition=center;';

          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_ZSBZ') { //追溯标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;ElementType&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_PSBZ') { //派生标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;requirement&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_YZBZ') { //验证标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;requirement&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_MZBZ') { //满足标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;ElementType&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_JHBZ') { //精化标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;requirement&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_ZXQBZ') { //主需求标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;requirement&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_YJBZ') { //依据标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;rationale&gt;&gt;', new mxGeometry(0, 0, 100, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_WTBZ') { //问题标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;problem&gt;&gt;', new mxGeometry(0, 0, 100, 20), 'html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;fontStyle=1;points=[];connectable=0;rotatable=0;movable=0;cloneable=0;resizable=0;rounded=0;editable=0;fitWidth=1;');
          text.vertex = true;
          text.geometry.relative = true
          cell.insert(text);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_BJD') { //包节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 90, 60),
            'shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=15;tabPosition=left;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;container=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'COMPLETECLASSIFICATION') { //完全分类图形
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 50, 20),
            'rounded=0;whiteSpace=wrap;html=1;strokeColor=none;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 10, 50, 10),
            'shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;fillColor=none;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell1.noInsert = true;
          cell.insert(cell1);

          var circle = new mxCell('', new mxGeometry(20, 0, 10, 10), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=none;');
          circle.vertex = true;
          circle.connectable = false;
          circle.noInsert = true;
          cell.insert(circle);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'NONCOMPLETECLASSIFICATION') { //非完全分类图形
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 50, 10),
            'rounded=0;whiteSpace=wrap;html=1;strokeColor=none;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 10, 50, 1),
            'line;strokeWidth=1;html=1;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell1.noInsert = true;
          cell.insert(cell1);

          var circle = new mxCell('', new mxGeometry(20, 0, 10, 10), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=none;');
          circle.vertex = true;
          circle.connectable = false;
          circle.noInsert = true;
          cell.insert(circle);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_ER_ENTITY') {
        let er;
        for (let i = 0; i < objectList.length; i++) {
          const obj = objectList[i];
          const displayNode = this.getDisplay(obj.children[0].getAttribute('display'));
          const display = displayNode.getAttribute('display');
          if (display === 'LABEL_ER_ATTRIBUTE') {
            window.LABELERATTRIBUTE = obj.children[0];
            er = obj.children[0];
            break
          }
        }

        fns.push(this.addEntry('', function () {
          // let qq = JSON.parse(JSON.stringify(obj.children[0]))
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 80), 'rounded=0;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;');
          cell.vertex = true;

          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=none;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(0, 20), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(160, 20), false); //end
          edge.geometry.relative = true;
          edge.connectable = false;
          edge.edge = true;
          edge.inside = true; //标记为内部画的线
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_ER_ATTRIBUTE') {} else {
        if (obj.getAttribute('sysMLRectangle') == '1' && display != 'LABEL_TIME_BUSINESS') {
          var className = obj.children[0].getAttribute('name');
          var objName = className;
          if (obj.getAttribute('class_flag') == '1') {
            objName = className + "的实例";
          }
          style = 'shape=rect;html=1;overflow=fill;whiteSpace=wrap;align=center;';
          var label = '<p style="margin:0px;margin-top:4px;text-align:center;">' +
            '&lt;&lt;' + className + '&gt;&gt;<br/>' +
            '<b>' + objName + '</b></p><hr/>' +
            '<p style="margin:0px;margin-left:8px;text-align:left;">' +
            '名称="' + objName + '..."</p>';
          obj.children[0].setAttribute("label", label);
          objType = "sysMLRectangle";
          fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        } else {
          if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
            style += 'container=1;'
          }
          fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
      }
    }

    // 关系
    if (obj.getAttribute('type') == "META_RELATIONSHIP") {

      window.ISTREENODEPAGE = true;
      window.edgeValue = obj.children[0];
      // hmx-add 添加建模元素关系线
      if (display === 'RELATION_UML_GLGX' || display === 'RELATION_UML_GL') {
        fns.push(this.addEntry('', function () {
          var edge = new mxCell(obj.children[0], new mxGeometry(0, 0, 0, 0), 'endArrow=none;endFill=0;endSize=12;html=1;');
          edge.geometry.setTerminalPoint(new mxPoint(80, 0), true);
          edge.geometry.setTerminalPoint(new mxPoint(0, 0), false);
          edge.geometry.relative = true;
          edge.edge = true;
          return sb.createEdgeTemplateFromCells([edge], 80, 0, '关联关系');
        }));
      } else if (display === 'RELATION_UML_KZGX') {
        fns.push(this.addEntry('', function () {
          var edge = new mxCell(obj.children[0], new mxGeometry(0, 0, 0, 0),
            'endArrow=open;endSize=12;dashed=1;html=1;');
          edge.geometry.setTerminalPoint(new mxPoint(100, 0), true);
          edge.geometry.setTerminalPoint(new mxPoint(0, 0), false);
          edge.geometry.relative = true;
          edge.edge = true;
          var text = new mxCell('extend', new mxGeometry(0.3, -10, 40, 10), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;');
          text.vertex = true;
          text.geometry.relative = true;
          edge.insert(text);
          return sb.createEdgeTemplateFromCells([edge], 80, 0, '扩展关系');
        }));
      } else if (display === 'RELATION_UML_BHGX') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=open;endSize=12;dashed=1;html=1;', 160, 0, 'include', '包含关系'));
      } else if (display === 'RELATION_UML_FHGX') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=block;endFill=0;endSize=12;html=1;', 160, 0, obj.children[0], '泛化关系'));
      } else if (display === 'RELATION_UML_JHGX') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=diamondThin;endFill=0;endSize=24;html=1;', 160, 0, obj.children[0], '聚合关系'));
      } else if (display === 'RELATION_UML_ZHGX') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=diamondThin;endFill=1;endSize=24;html=1;strokeColor=#000000;', 160, 0, obj.children[0], '组合关系'));
      } else if (display === 'RELATION_UML_YLGX') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=open;endFill=1;endSize=12;html=1;strokeColor=#000000;dashed=1;', 160, 0, obj.children[0], '依赖关系'));
      } else if (display === 'RELATION_UML_IMPLEMENT') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=block;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;rounded=0;dashed=1;endFill=0;', 160, 0, obj.children[0], '实现关系'));
      } else if (display === 'RELATION_UML_ZXSX') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=open;endFill=1;endSize=12;html=1;strokeColor=#000000;', 160, 0, obj.children[0], '执行顺序'));
      } else if (display === 'RELATION_UML_ZY') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=open;endFill=1;endSize=12;html=1;strokeColor=#000000;edgeStyle=orthogonalEdgeStyle;', 160, 0, obj.children[0], '转移'));
      } else if (display === 'RELATION_UML_JDXX') {
        fns.push(sb.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=open;endFill=1;endSize=12;html=1;strokeColor=#000000;', 160, 0, obj.children[0], '简单消息'));
      } else if (display === 'RELATION_UML_FHXX') {
        fns.push(this.addEntry('', function () {
          var edge = new mxCell(obj.children[0], new mxGeometry(0, 0, 0, 0),
            'html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;');
          edge.geometry.setTerminalPoint(new mxPoint(80, 0), true);
          edge.geometry.setTerminalPoint(new mxPoint(0, 0), false);
          edge.geometry.relative = true;
          edge.edge = true;
          var text = new mxCell('return', new mxGeometry(0.5, -20, 30, 10),
            'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;');
          text.vertex = true;
          text.geometry.relative = true;
          edge.insert(text);
          return sb.createEdgeTemplateFromCells([edge], 80, 0, '返回消息');
        }));
      } else if (display === 'RELATION_UML_ZGLXX') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell('', new mxGeometry(0, 20, 0, 0), '');
          cell.vertex = true;
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'edgeStyle=orthogonalEdgeStyle;html=1;align=left;spacingLeft=2;endArrow=block;rounded=0;');
          edge.geometry.setTerminalPoint(new mxPoint(5, 0), true);
          edge.geometry.points = [new mxPoint(30, 0)];
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insertEdge(edge, false);
          return sb.createVertexTemplateFromCells([cell, edge], 10, 60, 'Self Call');
        }));
      } else if (display === 'RELATION_UML_TBXX') {
        fns.push(sb.createEdgeTemplateEntry('endArrow=open;startArrow=cross;endFill=0;startFill=0;endSize=8;startSize=10;html=1;', 160, 0, obj.children[0], '同步消息'));
      } else if (display === 'RELATION_UML_XSXX') {
        fns.push(sb.createEdgeTemplateEntry('endArrow=open;startArrow=oval;endFill=0;startFill=0;endSize=8;startSize=10;html=1;', 160, 0, obj.children[0], '限时消息'));
      } else if (display === 'RELATION_UML_YBXX') {
        fns.push(sb.createEdgeTemplateEntry('endArrow=openAsync;endFill=0;endSize=12;html=1;strokeColor=#000000;', 160, 0, obj.children[0], '异步消息'));
      } else if (display === 'RELATION_DFD_SJL') {
        fns.push(sb.createEdgeTemplateEntry('endArrow=block;endFill=1;endSize=14;html=1;edgeStyle=orthogonalEdgeStyle;', 160, 0, obj.children[0], '数据流'));
      } else if (display === 'RELATION_ER_LX') {
        fns.push(sb.createEdgeTemplateEntry('endArrow=none;endFill=0;endSize=12;html=1;', 160, 0, obj.children[0], '联系'));
      } else if (display === 'UML_DEPLOYMENT_COMMUNICATION') {
        fns.push(sb.createEdgeTemplateEntry('endArrow=none;endFill=0;endSize=12;html=1;edgeStyle=orthogonalEdgeStyle;', 160, 0, obj.children[0], '通信路径'));
      } else if (display === 'UML_COMPONENT_REALIZATION') { //接口实现
        if (obj.getAttribute('sysMLRectangle') == '1' && display != 'LABEL_TIME_BUSINESS') {
          var className = obj.children[0].getAttribute('name');
          var objName = className;
          if (obj.getAttribute('class_flag') == '1') {
            objName = className + "的实例";
          }
          style = 'shape=rect;html=1;overflow=fill;whiteSpace=wrap;align=center;';
          var label = '<p style="margin:0px;margin-top:4px;text-align:center;">' +
            '&lt;&lt;' + className + '&gt;&gt;<br/>' +
            '<b>' + objName + '</b></p><hr/>' +
            '<p style="margin:0px;margin-left:8px;text-align:left;">' +
            '名称="' + objName + '..."</p>';
          obj.children[0].setAttribute("label", label);
          objType = "sysMLRectangle";
          fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
        if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
          style += 'container=1;'
        }
        fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'UML_COMPONENT_USAGE') { //使用
        fns.push(this.addEntry('', function () {
          var edge = new mxCell(obj.children[0], new mxGeometry(0, 0, 0, 0),
            'endArrow=block;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;');
          edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
          edge.geometry.setTerminalPoint(new mxPoint(100, 0), false);
          edge.geometry.relative = true;
          edge.edge = true;
          var text = new mxCell('&lt;&lt;extend&gt;&gt;', new mxGeometry(-0.5, 10, 60, 10), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;');
          text.vertex = true;
          text.geometry.relative = true;
          edge.insert(text);
          return sb.createEdgeTemplateFromCells([edge], 100, 0, '使用');
        }));
      } else if (display === 'SYSML_SEQUENCE_GUOLVPIANDUANJIEDIAN') { //过滤片段节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 160), 'shape=umlFrame;whiteSpace=wrap;html=1;noLabel=1;');
          cell.value.setAttribute('label', '')
          const title = new mxCell('alt', new mxGeometry(0, 0), 'html=1;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
          title.vertex = true
          title.geometry.offset = new mxPoint(5, 0);
          title.geometry.relative = true
          title.connectable = '0'
          cell.insert(title);

          cell.vertex = true;

          var text1 = new mxCell('if', new mxGeometry(0, 0, 170, 20), 'text;html=1;autosize=1;resizable=0;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text1.geometry.offset = new mxPoint(5, 30)
          text1.vertex = true
          text1.geometry.relative = true;
          // var text1 = new mxCell('if', new mxGeometry(0, 0, 0, 0), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;');
          // text1.geometry.setTerminalPoint(new mxPoint(180, 20), true); //start
          // text1.geometry.setTerminalPoint(new mxPoint(0, 20), false); //end
          // text1.edge = true;
          // text1.geometry.relative = true;
          cell.insert(text1)
          var text2 = new mxCell('else', new mxGeometry(0, 0, 170, 20), 'text;html=1;autosize=1;resizable=0;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text2.geometry.offset = new mxPoint(5, 90)
          text2.vertex = true
          text2.geometry.relative = true;
          // var text2 = new mxCell('else', new mxGeometry(0, 0, 0, 0), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;');
          // text2.geometry.setTerminalPoint(new mxPoint(180, 100), true);
          // text2.geometry.setTerminalPoint(new mxPoint(0, 100), false);
          // text2.edge = true;
          // text2.geometry.relative = true;
          cell.insert(text2)
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=none;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(180, 80), true);
          edge.geometry.setTerminalPoint(new mxPoint(0, 80), false);
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LINE_ONETOMULLINE') { //一对多确定连线
        fns.push(this.createEdgeTemplateEntry(style, 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '非确定关系'));
      } else if (display === 'LINE_ONETOMULNONLINE') { // 一对多非确定连线
        fns.push(this.createEdgeTemplateEntry(style, 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '标定关系'));
      } else if (display === 'LINE_MULTOMULLINE') { //多对多连线
        fns.push(this.createEdgeTemplateEntry(style, 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '非标定关系'));
      } else if (display === 'LINE_COMPLETECLASSIFICATION') {
        fns.push(this.createEdgeTemplateEntry(style + 'startArrow=ERzeroToComplete2;startFill=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, ''));
      } else if (display === 'LINE_NONCOMPLETECLASSIFICATION') {
        fns.push(this.createEdgeTemplateEntry(style + 'startArrow=ERzeroToComplete1;startFill=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, ''));
      } else if (display === 'LINE_BPMN_DEFAULT_SORT_FLOW_LINE') {
        fns.push(this.createEdgeTemplateEntry('startArrow=dash;startSize=8;endArrow=block;endFill=1;endSize=14;html=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, 'BPMN默认顺序线'));
      } else if (display === 'LINE_BPMN_CONDITION_SORT_FLOW_LINE') {
        fns.push(this.createEdgeTemplateEntry('startArrow=diamondThin;startFill=0;startSize=18;endArrow=block;endFill=1;endSize=14;html=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, 'BPMN条件顺序线'));
      } else if (display === 'LINE_BPMN_MESSAGE_FLOW_LINE') {
        fns.push(this.createEdgeTemplateEntry('startArrow=oval;startFill=0;startSize=7;endArrow=block;endFill=0;endSize=10;dashed=1;html=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, 'BPMN消息线'));
      } else if (display === 'LINE_BPMN_CONVERSATION_LINE') {
        fns.push(this.createEdgeTemplateEntry('shape=link;html=1;edgeStyle=orthogonalEdgeStyle;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, 'BPMN消息交流线'));
      } else if (display === 'LINE_BPMN_DATA_UNIT_RELATION_LINE') {
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=1;endSize=12;html=1;dashed=1;edgeStyle=orthogonalEdgeStyle;rounded=0;strokeColor=#6666FF;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, 'BPMN数据联合关系线'));
      } else if (display === 'RELATION_TASK_CHOREOGRAPHY') {
        fns.push(this.createEdgeTemplateEntry('shape=link;html=1;edgeStyle=orthogonalEdgeStyle;strokeColor=#6666FF;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, 'BPMN任务编排关系线'));
      } else if (display === 'RELATION_BPMN_BOUNDARY') {
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=1;endSize=12;html=1;dashed=1;edgeStyle=orthogonalEdgeStyle;rounded=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, 'BPMN编辑关系线'));
      } else if (display === 'LINE_ORDINARY_TREE_LINE') {
        fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;rounded=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '树形连线'));
      } else if (display === 'LINE_ORDINARY_STRAIGHT') { // 引用关联
        obj.children[0].setAttribute('endArrow', 'classic')
        // fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;rounded=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '普通直线'));
        // obj.children[0].setAttribute('endArrow', 'none')
        fns.push(this.createEdgeTemplateEntry('endArrow=none;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;rounded=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '普通直线'));
      } else if (display === 'LINE_ORDINARY_VERTICAL_CHART') {
        let arrow = ''
        if (obj.children[0].getAttribute('name') === '项目流') {
          arrow = 'endArrow=classic;'
        } else {
          arrow = 'endArrow=none;' // 连接器
        }
        fns.push(this.createEdgeTemplateEntry(arrow + 'html=1;edgeStyle=orthogonalEdgeStyle;startArrow=none;startFill=1;endFill=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '普通垂直折线'));
      } else if (display === 'LINE_ORDINARY_NODE') {
        fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;rounded=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '普通节点线'));
      } else if (display === 'LINE_HORIZONTAL_STRAIGHT') {
        obj.children[0].setAttribute('label', obj.children[0].getAttribute('name'));
        fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;rounded=0;align=center;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '水平直线'));
      } else if (display === 'SYSML_BLOCKDEFINITION_FUHEGUANLAIPATH') {
        fns.push(this.createEdgeTemplateEntry(`endArrow=open;endFill=0;endSize=14;html=1;startSize=18;startArrow=diamondThin;startFill=1;edgeStyle=orthogonalEdgeStyle;`, 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '复合关联路径'));
      } else if (display === 'SYSML_BLOCKDEFINITION_YINYONGGUANLIANPATH') {
        // 模块定义图 特殊处理
        fns.push(this.createEdgeTemplateEntry('startSize=18;endArrow=none;endFill=0;endSize=14;html=1;edgeStyle=orthogonalEdgeStyle;' + obj.getAttribute('line_style'), 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '引用关联路径'));
      } else if (display === 'SYSML_BLOCKDEFINITION_GUANLIANKUAIPATHHEJIEDIAN') {
        fns.push(this.createEdgeTemplateEntry('endArrow=none;endFill=0;endSize=14;html=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '关联块路径和节点'));
      } else if (display === 'SYSML_BLOCKDEFINITION_FANHUAPATH') { //泛化关系线
        fns.push(this.createEdgeTemplateEntry('endArrow=block;endFill=0;endSize=10;html=1;startArrow=none;startFill=0;startSize=10;edgeStyle=orthogonalEdgeStyle;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '泛化路径'));
      } else if (display === 'SYSML_BLOCKDEFINITION_HUODONGZUHEPATH') {
        fns.push(this.createEdgeTemplateEntry('endArrow=diamondThin;endFill=1;endSize=9;html=1;startArrow=open;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '活动组合路径'));
      } else if (display === 'SYSML_BLOCKDEFINITION_DINGXIANGGUANLIANPATH') { //定向关联关系线
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '定向关联路径'));
      } else if (display === 'SYSML_BLOCKDEFINITION_DUIXIANGJIEDIANZUHEPATH') {
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startSize=18;startArrow=diamondThin;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '对象节点组合路径'));
      } else if (display === 'SYSML_BLOCKDEFINITION_GUANLIANSHILIGUIFANPATH') {
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '关联实例规范路径'));
      } else if (display === 'SYSML_PACKAGE_BAOHANPATH') { //包含路径
        fns.push(this.createEdgeTemplateEntry('startArrow=circlePlus;endFill=0;endSize=14;html=1;endArrow=none;startFill=0;edgeStyle=segmentEdgeStyle;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '包含路径'));
      } else if (display === 'LINE_KEZHIXING') { //可执行直线
        obj.children[0].setAttribute("label", "可执行");
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '可执行直线'));
      } else if (display === 'LINE_SHISHI') { //实施直线
        obj.children[0].setAttribute("label", "实施");
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '实施直线'));
      } else if (display === 'SYSML_PACKAGE_DAORUPATH') { //导入路径
        obj.children[0].setAttribute('label', "import");
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '导入路径'));
      } else if (display === 'SYSML_PACKAGE_YILAIPATH') { //依赖路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '依赖路径'));
      } else if (display === 'SYSML_INTERNALMODULE_LIANJIEQILUJING') { //连接器路径
        // fns.push(this.createEdgeTemplateEntry('html=1;endFill=1;edgeStyle=elbowEdgeStyle;startArrow=diamond;startFill=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '连接器路径'));
        fns.push(this.createEdgeTemplateEntry('endArrow=none;html=1;edgeStyle=orthogonalEdgeStyle;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '连接器路径'));
      } else if (display === 'SYSML_INTERNALMODULE_LIANJIEQISHUXINGLUJINGHEJIEDIAN') { //连接器属性路径和节点
        fns.push(this.createEdgeTemplateEntry('endArrow=none;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '连接器属性路径和节点'));
      } else if (display === 'SYSML_INTERNALMODULE_XIANGLIUJIEDIAN') { //项流节点
        fns.push(this.createEdgeTemplateEntry('endArrow=block;endFill=1;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '项流节点'));
      } else if (display === 'SYSML_INTERNALMODULE_FANHUAPATH') { //泛化关系线
        fns.push(this.createEdgeTemplateEntry('endArrow=block;endFill=0;endSize=14;html=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '泛化路径'));
      } else if (display === 'SYSML_INTERNALMODULE_YILAIPATH') {
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '依赖路径'));
      } else if (display === 'SYSML_INTERNALMODULE_YINYONGGUANLIANPATH') {
        fns.push(this.createEdgeTemplateEntry('endArrow=none;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '引用关联路径'));
      } else if (display === 'SYSML_BLOCKDEFINITION_YILAIPATH') { //依赖路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;edgeStyle=orthogonalEdgeStyle;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '依赖路径'));
      } else if (display === 'SYSML_PARAMETRIC_ZHIBANGDINGLUJING') { //值绑定路径
        fns.push(this.createEdgeTemplateEntry('endArrow=none;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;edgeStyle=orthogonalEdgeStyle;strokeWidth=2;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '值绑定路径'));
      } else if (display === 'SYSML_PARAMETRIC_YILAIPATH') { //依赖路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '依赖路径'));
      } else if (display === 'SYSML_PARAMETRIC_FANHUAPATH') { //泛化路径
        fns.push(this.createEdgeTemplateEntry('endArrow=block;endFill=0;endSize=14;html=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '泛化路径'));
      } else if (display === 'SYSML_PARAMETRIC_YINYONGGUANLIANPATH') {
        fns.push(this.createEdgeTemplateEntry('endArrow=none;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '引用关联路径'));
      } else if (display === 'SYSML_ACTIVITY_DUIXIANGLIULUJING') { //对象流路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '对象流路径'));
      } else if (display === 'SYSML_ACTIVITY_KONGZHILIULUJING') { //控制流路径
        // fns.push(this.addEntry('', function () {
        //   var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 20, 20), 'rounded=1;whiteSpace=wrap;html=1;align=center;');
        //   cell.vertex = true;
        //   var cell1 = new mxCell('', new mxGeometry(0, 0, 10, 10),
        //     'rounded=0;html=1;verticalAlign=middle;align=center;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;aspect=fixed;');
        //   cell1.geometry.offset = new mxPoint(-10, 5);
        //   cell1.geometry.relative = true;
        //   cell1.vertex = true;
        //
        //   var cell2 = new mxCell('', new mxGeometry(0, 0, 10, 10),
        //     'rounded=0;html=1;verticalAlign=middle;align=center;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;aspect=fixed;');
        //   cell2.geometry.offset = new mxPoint(20, 5);
        //   cell2.geometry.relative = true;
        //   cell2.vertex = true;
        //
        //   var edge1 = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=10;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=0;aspect=fixed;');
        //   edge1.geometry.setTerminalPoint(new mxPoint(-40, 10), true);  //start
        //   edge1.geometry.setTerminalPoint(new mxPoint(-10, 10), false);  //end
        //   edge1.geometry.relative = true;
        //   edge1.edge = true;
        //
        //   var edge2 = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=10;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=0;aspect=fixed;');
        //   edge2.geometry.setTerminalPoint(new mxPoint(30, 10), true);  //start
        //   edge2.geometry.setTerminalPoint(new mxPoint(60, 10), false);  //end
        //   edge2.geometry.relative = true;
        //   edge2.edge = true;
        //   cell.insert(cell1);
        //   cell.insert(cell2);
        //   cell.insert(edge1);
        //   cell.insert(edge2);
        //   return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        // }));
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;dashed=1;edgeStyle=orthogonalEdgeStyle;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '控制流路径'));
      } else if (display === 'SYSML_ACTIVITY_DUIXIANGLIUJIEDIAN') { //对象流节点
        // fns.push(this.addEntry('', function (){
        //   var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 20, 20), 'rounded=1;whiteSpace=wrap;html=1;align=center;');
        //   cell.vertex = true;
        //   var cell1 = new mxCell('', new mxGeometry(0, 0, 10, 10),
        //     'rounded=0;html=1;verticalAlign=middle;align=center;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;aspect=fixed;');
        //   cell1.geometry.offset = new mxPoint(-10, 5);
        //   cell1.geometry.relative = true;
        //   cell1.vertex = true;
        //
        //   var cell2 = new mxCell('', new mxGeometry(0, 0, 10, 10),
        //     'rounded=0;html=1;verticalAlign=middle;align=center;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;aspect=fixed;');
        //   cell2.geometry.offset = new mxPoint(20, 5);
        //   cell2.geometry.relative = true;
        //   cell2.vertex = true;
        //
        //   var edge1 = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=10;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
        //   edge1.geometry.setTerminalPoint(new mxPoint(-40, 10), true);  //start
        //   edge1.geometry.setTerminalPoint(new mxPoint(-10, 10), false);  //end
        //   edge1.geometry.relative = true;
        //   edge1.edge = true;
        //
        //   var edge2 = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=10;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
        //   edge2.geometry.setTerminalPoint(new mxPoint(30, 10), true);  //start
        //   edge2.geometry.setTerminalPoint(new mxPoint(60, 10), false);  //end
        //   edge2.geometry.relative = true;
        //   edge2.edge = true;
        //   cell.insert(cell1);
        //   cell.insert(cell2);
        //   cell.insert(edge1);
        //   cell.insert(edge2);
        //   return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        // }));
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '对象流节点'));
      } else if (display === 'SYSML_ACTIVITY_ZHONGDUANBIANJIELUJING') { //中断边界路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '中断边界路径'));
      } else if (display === 'SYSML_SEQUENCE_TONGBUXIAOXI') { //同步消息
        obj.children[0].setAttribute('label', obj.children[0].getAttribute('name'));
        fns.push(this.createEdgeTemplateEntry('endArrow=blockThin;endFill=1;endSize=14;html=1;startArrow=none;startFill=0;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;align=center;labelPosition=center;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '同步消息'));
      } else if (display === 'SYSML_SEQUENCE_YIBUXIAOXI') { //异步消息
        obj.children[0].setAttribute('label', obj.children[0].getAttribute('name'));
        fns.push(this.createEdgeTemplateEntry('endSize=14;html=1;align=left;spacingLeft=2;endArrow=open;rounded=0;align=center;labelPosition=center;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '异步消息'));
      } else if (display === 'SYSML_SEQUENCE_YINGDAXIAOXI') { //应答消息
        obj.children[0].setAttribute('label', obj.children[0].getAttribute('name'));
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;align=center;labelPosition=center;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '应答消息'));
      } else if (display === 'SYSML_SEQUENCE_DIUSHIXIAOXILUJING') { //丢失消息路径
        obj.children[0].setAttribute('label', obj.children[0].getAttribute('name'));
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;align=center;labelPosition=center;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '丢失消息路径'));
      } else if (display === 'LINE_SELFMESSAGE') { //丢失消息路径
        obj.children[0].setAttribute('label', obj.children[0].getAttribute('name'));
        fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;edgeStyle=orthogonalEdgeStyle;dashed=0;startArrow=none;startFill=0;endArrow=block;endFill=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, 'Message to Self'));
      } else if (display === 'SYSML_SEQUENCE_FASONGXIAOXILUJING') { //发送消息路径
        fns.push(this.createEdgeTemplateEntry('endArrow=circle;html=1;entryPerimeter=0;exitPerimeter=0;endFill=1;startArrow=open;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '发送消息路径'));
      } else if (display === 'SYSML_SEQUENCE_CHUANGJIANXIAOXILUJING') { //创建消息路径
        obj.children[0].setAttribute('label', obj.children[0].getAttribute('name'));
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;align=center;labelPosition=center;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '创建消息路径'));
      } else if (display === 'SYSML_STATEMACHINE_FSXHJD') { //发送信号节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 35), 'html=1;shape=mxgraph.sysml.sendSigAct;strokeWidth=1;whiteSpace=wrap;align=center;');
          cell.vertex = true;
          // var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 35), 'shape=mxgraph.flowchart.annotation_1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;flipH=0;aspect=fixed;');
          // cell.vertex = true;
          // var cell1 = new mxCell('', new mxGeometry(160, 0, 30, 35), 'shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;strokeColor=#000000;size=50;direction=west;flipH=1;strokeWidth=1;aspect=fixed;');
          // cell1.vertex = true;
          // cell1.connectable = false;
          // cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
        // fns.push(this.createEdgeTemplateEntry('html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;rounded=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '发送信号节点'));
      } else if (display === 'SYSML_STATEMACHINE_CFJD') { //触发节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 35), 'html=1;shape=mxgraph.sysml.accEvent;strokeWidth=1;whiteSpace=wrap;align=center;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_USECASE_GLLJ') { //关联路径
        fns.push(this.createEdgeTemplateEntry('endArrow=none;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '关联路径'));
      } else if (display === 'SYSML_USECASE_KZLJ') { //扩展路径
        obj.children[0].setAttribute("label", "extend")
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '扩展路径'));
      } else if (display === 'SYSML_USECASE_BHLJ') { //包含路径
        obj.children[0].setAttribute("label", "include")
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '包含路径'));
      } else if (display === 'SYSML_USECASE_FHLJ') { //泛化路径
        fns.push(this.createEdgeTemplateEntry('endArrow=block;html=1;entryPerimeter=0;exitPerimeter=0;endFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '泛化路径'));
      } else if (display === 'SYSML_USECASE_YLLJ') { //依赖路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;html=1;entryPerimeter=0;exitPerimeter=0;endFill=0;dashed=1', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '依赖路径'));
      } else if (display === 'SYSML_REQUIREMENT_PAISHENGLUJING') { //派生路径
        obj.children[0].setAttribute('label', "deriveReqt");
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '派生路径'));
      } else if (display === 'SYSML_REQUIREMENT_MANZULUJING') { //满足路径

        obj.children[0].setAttribute("label", "satisfy")
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '满足关系'));
      } else if (display === 'SYSML_REQUIREMENT_YANZHENGLUJING') { //验证路径

        obj.children[0].setAttribute('label', "verify");
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '验证关系'));
      } else if (display === 'SYSML_REQUIREMENT_PAISHENGXUQIULUJING') { //派生需求路径

        obj.children[0].setAttribute("label", "copy")
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '派生需求'));
      } else if (display === 'SYSML_REQUIREMENT_JINGHUALUJING') { //精化路径

        obj.children[0].setAttribute("label", "refine")
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '改善关系'));
      } else if (display === 'SYSML_REQUIREMENT_ZHUISULUJING') { //追溯路径
        obj.children[0].setAttribute("label", "trace")
        fns.push(this.createEdgeTemplateEntry('endArrow=open;endFill=0;endSize=14;html=1;startArrow=none;startFill=0;dashed=1;labelPosition=top;verticalLabelPosition=top;verticalAlign=bottom;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '跟踪关系'));
      } else if (display === 'SYSML_REQUIREMENT_FUZHILUJING') { //复制路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;html=1;entryPerimeter=0;startSize=18;endSize=14;exitPerimeter=0;endFill=0;dashed=1;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '复制路径'));
      } else if (display === 'SYSML_REQUIREMENT_BAOHANLUJING') { //包含路径
        fns.push(this.createEdgeTemplateEntry('startArrow=circlePlus;endFill=0;endSize=14;html=1;endArrow=none;startFill=0;edgeStyle=segmentEdgeStyle;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '包含路径'));
      } else if (display === 'SYSML_STATEMACHINE_SJSJZHLJ') { //时间事件转换路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;html=1;entryPerimeter=0;exitPerimeter=0;endFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '时间事件转换路径'));
      } else if (display === 'SYSML_STATEMACHINE_XHSJZHLJ') { //信号事件转换路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;html=1;entryPerimeter=0;exitPerimeter=0;endFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '信号事件转换路径'));
      } else if (display === 'SYSML_STATEMACHINE_DYSJZHLJ') { //调用事件转换路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;html=1;entryPerimeter=0;exitPerimeter=0;endFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '调用事件转换路径'));
      } else if (display === 'SYSML_STATEMACHINE_GGSJZHLJ') { //更改事件转换路径
        fns.push(this.createEdgeTemplateEntry('endArrow=open;html=1;entryPerimeter=0;exitPerimeter=0;endFill=0;', 160, 0, obj.children[0], obj.getAttribute('tooltip'), null, '更改事件转换路径'));
      } else if (display === 'LINE_VERTICAL_DOTTED') { //与线
        fns.push(this.createEdgeTemplateEntry('endArrow=none;html=1;entryPerimeter=0;exitPerimeter=0;endFill=0;dashed=1;', 0, 160, obj.children[0], obj.getAttribute('tooltip'), null, '与线'));
      } else {
        fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;edgeStyle=orthogonalEdgeStyle;', 50, 50, obj.children[0], obj.getAttribute('tooltip'), null, ''));
      }
    }

    // 引用
    if (obj.getAttribute('type') == "QUOTE") {
      var objType = "";

      if (display === 'LABEL_INPUT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_TIMEAXIS') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, width, height), 'html=1;fillColor=#ffffff;');
          obj.children[0].setAttribute("label", '时间轴');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
        /**
         <type display='LABEL_TIMEAXIS' name='时间轴'
         style='shape=flexArrow;endArrow=classic;html=1;fillColor=#ffffff;endWidth=47;endSize=18.42;width=31;collapsible=0;recursiveResize=0;outlineConnect=1;'
         w='650' h='50'/>
         */
      } else if (display === 'SYSML_STATEMACHINE_ZHUANGTAI') { //状态
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, width, height), 'shape=rect;arcSize=7;rounded=1;html=1;overflow=fill;whiteSpace=wrap;align=center;container=1;');
          var label = `<div style="width: 100%;height:40px"><div style="line-height: 40px;margin: 0px ; text-align: center"><b style="font-weight: 700">${cell.value.getAttribute('name')}</b></div></div><hr style="width:100%;margin-top:0px;" />`;
          obj.children[0].setAttribute("label", label);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 180, 160)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_OUTPUT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var edge = new mxCell('', new mxGeometry(0, 0, 40, 40), 'endArrow=none;html=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(100, 30), false);
          edge.geometry.setTerminalPoint(new mxPoint(70, 0), true);
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);

          var text = new mxCell('Out', new mxGeometry(0, 0, 30, 20), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;');
          text.vertex = true;
          cell.insert(text);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_JUMP') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var circle1 = new mxCell('', new mxGeometry(35, 20, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#f8b57e;aspect=fixed;');
          circle1.vertex = true;
          cell.insert(circle1);

          var circle2 = new mxCell('', new mxGeometry(35, 50, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#f8b57e;aspect=fixed;');
          circle2.vertex = true;
          cell.insert(circle2);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_PARALLEL') {
        console.log('并行网关')
        console.log(obj.getAttribute('tooltip'))
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(20, 20, 20, 20), 'shape=umlDestroy;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#33001A;direction=west;rotation=-45;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_USER') {
        console.log('用户任务')
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 0, 14, 14), 'html=1;shape=mxgraph.bpmn.user_task;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'ACTIVITY_COMPENSATION') {
        console.log('补偿活动')
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell2 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=mxgraph.bpmn.compensation;html=1;outlineConnect=0;');
          cell2.vertex = true;
          cell2.geometry.relative = true;
          cell2.geometry.offset = new mxPoint(-7, -14);
          cell.insert(cell2);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'CHOREOGRAPHYTASK_DEFAULT' || display === 'CHOREOGRAPHYTASK_CALL') {
        console.log('编排任务')
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('',
            new mxGeometry(0, 0, 120, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;bottomRightStyle=square;bottomLeftStyle=square;part=1;');
          cell1.vertex = true;
          cell.insert(cell1);

          var cell2 = new mxCell('',
            new mxGeometry(0, 0, 120, 60),
            'shape=mxgraph.bpmn.task;part=1;taskMarker=abstract;connectable=0;whiteSpace=wrap;fillColor=none;');
          cell2.vertex = true;
          cell.insert(cell2);

          var cell3 = new mxCell('',
            new mxGeometry(0, 1, 20, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;topRightStyle=square;topLeftStyle=square;fillColor=#C0C0C0;part=1;');
          cell3.vertex = true;
          cell3.geometry.relative = false;
          cell.insert(cell3);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'CHOREOGRAPHYTASK_SUB' || display === 'CHOREOGRAPHYTASK_CALL_SUB') {
        console.log('子编排任务')
        fns.push(this.addEntry('sub choreography collapsed', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('',
            new mxGeometry(0, 0, 120, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;bottomRightStyle=square;bottomLeftStyle=square;part=1;');
          cell1.vertex = true;
          cell.insert(cell1);

          var cell2 = new mxCell('',
            new mxGeometry(0, 0, 120, 60),
            'shape=mxgraph.bpmn.task;arcSize=0;taskMarker=abstract;part=1;isLoopSub=1;connectable=0;whiteSpace=wrap;fillColor=none;');
          cell2.vertex = true;
          cell.insert(cell2);

          var plus = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;html=1;outlineConnect=0;');
          plus.vertex = true;
          plus.geometry.relative = true;
          plus.geometry.offset = new mxPoint(-7, -14);
          cell2.insert(plus);

          var cell3 = new mxCell('',
            new mxGeometry(0, 1, 20, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;topRightStyle=square;topLeftStyle=square;fillColor=#C0C0C0;part=1;');
          cell3.vertex = true;
          cell3.geometry.relative = false;
          cell.insert(cell3);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'CONVERSATION_SUB' || display === 'CONVERSATION_XIEZUO') {
        console.log('子对话');
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(-7, -14);
          cell.insert(cell1);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_COMPENSATION') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(13, 15, 20, 20), 'shape=mxgraph.bpmn.compensation;html=1;outlineConnect=0;fillColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'DATA_INPUT') {
        console.log('输入数据');
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 0, 14, 14), 'html=1;shape=singleArrow;arrowWidth=0.4;arrowSize=0.4;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(2, 2);
          cell.insert(cell1);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_SIGNAL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=mxgraph.flowchart.extract_or_measurement;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_ERROR') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=tape;whiteSpace=wrap;html=1;fillColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_MULTIPLE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_MESSAGE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 25, 18), 'shape=message;whiteSpace=wrap;html=1;outlineConnect=0;fillColor=#000000;strokeColor=#ffffff;strokeWidth=2;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_END_END') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(12, 12, 26, 26), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#000000;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_SIGNAL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=mxgraph.flowchart.extract_or_measurement;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'PARTICIPANT_CONVERSATION') {
        fns.push(this.addEntry('sub choreography collapsed', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;

          var cell1 = new mxCell('',
            new mxGeometry(0, 0, 120, 20),
            'whiteSpace=wrap;connectable=0;html=1;shape=mxgraph.basic.rect;size=10;rectStyle=rounded;bottomRightStyle=square;bottomLeftStyle=square;fillColor=#C0C0C0;part=1;');
          cell1.vertex = true;
          cell.insert(cell1);

          var cell2 = new mxCell('',
            new mxGeometry(0, 0, 120, 80),
            'shape=mxgraph.bpmn.task;arcSize=0;taskMarker=abstract;part=1;isLoopSub=1;connectable=0;whiteSpace=wrap;fillColor=none;');
          cell2.vertex = true;
          cell.insert(cell2);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_MUL_PARALLEL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=cross;whiteSpace=wrap;html=1;align=center;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_MESSAGE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 17, 20, 16), 'html=1;shape=message;outlineConnect=0;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_MESSAGE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 17, 20, 16), 'shape=message;whiteSpace=wrap;html=1;outlineConnect=0;fillColor=#000000;strokeColor=#ffffff;strokeWidth=2;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_COMPENSATION') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(13, 15, 20, 20), 'shape=mxgraph.bpmn.compensation;html=1;outlineConnect=0;fillColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_MULTIPLE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_THROW_LINK') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 17.5, 22, 15), 'shape=mxgraph.arrows.arrow_right;whiteSpace=wrap;html=1;fillColor=#000000;strokeColor=#000000;strokeWidth=2;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_MULTIPLE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_SIGNAL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.flowchart.extract_or_measurement;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_MESSAGE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 17, 20, 16), 'html=1;shape=message;outlineConnect=0;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_MUL_PARALLEL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=cross;whiteSpace=wrap;html=1;align=center;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_START_TIME') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(7.5, 7.5, 35, 35), 'shape=mxgraph.bpmn.timer_start;html=1;align=center;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_SERVICE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 20, 20), 'shape=mxgraph.bpmn.service_task;html=1;outlineConnect=0;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SUB_PROCESS_BUSINESS') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(-7, -16);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_SCRIPT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 20, 20), 'shape=mxgraph.bpmn.script_task;html=1;outlineConnect=0;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_SEND') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 30, 20), 'shape=message;whiteSpace=wrap;html=1;outlineConnect=0;fillColor=#000000;strokeColor=#ffffff;strokeWidth=2;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SUB_PROCESS_DEFAULT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(-7, -14);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_RULE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 20, 15), 'shape=mxgraph.bpmn.business_rule_task;html=1;outlineConnect=0;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SUB_PROCESS_EVENT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;outlineConnect=0;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(-7, -14);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'TASK_RECV') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true
          var cell1 = new mxCell('', new mxGeometry(0, 0, 30, 20), 'html=1;shape=message;outlineConnect=0;aspect=fixed;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(7, 7);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_EXCLUSIVE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(27.5, 15, 5, 30), 'rounded=0;whiteSpace=wrap;html=1;fillColor=#000000;rotation=45;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_COMPLEX') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(20, 20, 20, 20), 'shape=umlDestroy;whiteSpace=wrap;html=1;strokeWidth=1;fillColor=#33001A;direction=west;rotation=-45;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          var symbol2 = new mxCell('', new mxGeometry(20, 20, 20, 20), 'shape=umlDestroy;whiteSpace=wrap;html=2;strokeWidth=2;fillColor=#33001A;direction=west;html=1;aspect=fixed;');
          symbol2.vertex = true;
          cell.insert(symbol2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_INSTANCE_PARALLEL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          var symbol2 = new mxCell('', new mxGeometry(20, 20, 20, 20), 'shape=cross;whiteSpace=wrap;html=1;align=center;aspect=fixed;aspect=fixed;');
          symbol2.vertex = true;
          cell.insert(symbol2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_EVENT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(12.5, 12.5, 35, 35), 'ellipse;shape=doubleEllipse;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          var symbol2 = new mxCell('', new mxGeometry(19, 20, 20, 18), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol2.vertex = true;
          cell.insert(symbol2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_INCLUSIVE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'GATEWAY_INSTANCE_EVENT') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 30, 30), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          var symbol2 = new mxCell('', new mxGeometry(19, 20, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol2.vertex = true;
          cell.insert(symbol2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_MULTIPLE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 15, 22, 20), 'shape=mxgraph.basic.pentagon;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_LINK') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(14, 17.5, 22, 15), 'shape=mxgraph.arrows.arrow_right;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;strokeWidth=1;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'EVENT_MIDDLE_CATCH_SIGNAL') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var symbol = new mxCell('', new mxGeometry(15, 15, 20, 20), 'shape=mxgraph.flowchart.extract_or_measurement;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#000000;aspect=fixed;');
          symbol.vertex = true;
          cell.insert(symbol);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      }

      // hmx-add 添加建模元素实体
      else if (display === 'UML_SHEJILEI') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;');
          cell.vertex = true;
          cell.insert(sb.cloneCell(field, '+ field: Type'));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, '+ method(type): type'));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_INTERFACE') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 120),
            'swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=40;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;');
          cell.vertex = true;
          cell.selectabled = false
          cell.insert(sb.cloneCell(field, '+ field: Type'));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, '+ method(type): type'));

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_QISHIDIAN') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 10), 'ellipse;html=1;aspect=fixed;fillColor=#000000;align=center;verticalAlign=top;rounded=0;labelPosition=center;verticalLabelPosition=bottom;');
          cell.vertex = true;
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(5, 10), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(5, 40), false); //end
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DUIXIANGSHILI') {
        fns.push(this.addEntry('', function () {
          return sb.createVertexTemplateFromCells([sb.cloneCell(field, '+ item: attribute')], field.geometry.width, field.geometry.height, '对象实例');
        }));
      } else if (display === 'UML_YEWUSHITI') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(26, -7, 59, 124), 'line;strokeWidth=1;html=1;direction=west;rotation=314;aspect=fixed;');
          cell1.vertex = true;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_CHUSHIZHUANGTAI') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 10), 'ellipse;html=1;aspect=fixed;fillColor=#000000;align=center;verticalAlign=top;rounded=0;labelPosition=center;verticalLabelPosition=bottom;');
          cell.vertex = true;
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(5, 10), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(5, 40), false); //end
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_FUHEZHUANGTAI') {
        fns.push(this.addEntry('', function () {
          var cell = new mxCell('', new mxGeometry(0, 0, 120, 60), 'html=1;whiteSpace=wrap;rounded=1;dropTarget=0;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 0, 40, 20), 'rounded=1;whiteSpace=wrap;html=1;');
          cell1.vertex = true;
          cell1.geometry.relative = true;
          cell1.geometry.offset = new mxPoint(70, 30);
          cell.insert(cell1);

          var cell2 = new mxCell('', new mxGeometry(0, 0, 40, 20), 'rounded=1;whiteSpace=wrap;html=1;');
          cell2.vertex = true;
          cell2.geometry.relative = true;
          cell2.geometry.offset = new mxPoint(12, 12);
          cell.insert(cell2);

          var cell3 = new mxCell('', new mxGeometry(0, 0, 20, 10), 'line;strokeWidth=1;html=1;direction=west;rotation=0;');
          cell3.vertex = true;
          cell3.geometry.relative = true;
          cell3.geometry.offset = new mxPoint(50, 27);
          cell.insert(cell3);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '复合状态');
        }));
      } else if (display === 'UML_DFD_WBX') { //外部项
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 0, 40, 56), 'shape=partialRectangle;whiteSpace=wrap;html=1;bottom=0;right=0;fillColor=none;');
          cell1.vertex = true;
          cell1.connectable = false;
          var cell2 = new mxCell('', new mxGeometry(6, 6, 68, 88), 'rounded=0;whiteSpace=wrap;html=1;fillColor=none;');
          cell2.vertex = true;
          cell2.connectable = false;
          cell.insert(cell1);
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DFD_SJJG') { //数据加工
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 70),
            'rounded=0;whiteSpace=wrap;html=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DFD_SJCC') { //数据存储
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 140, 46),
            'shape=partialRectangle;whiteSpace=wrap;html=1;bottom=1;right=1;left=1;top=0;fillColor=none;routingCenterX=-0.5;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;direction=south;');
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 3, 46, 40), 'line;strokeWidth=1;html=1;direction=west;rotation=-90;');
          cell1.vertex = true;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_ER_RGX') { //弱关系
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 6, 140, 72), 'html=1;whiteSpace=wrap;aspect=fixed;shape=isoRectangle;fillColor=none;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_ER_GH') { //概化
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 60), 'triangle;whiteSpace=wrap;html=1;direction=south;');
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(35, -24, 30, 24), 'line;strokeWidth=1;direction=south;html=1;');
          cell1.vertex = true;
          cell.insert(cell1);
          var cell2 = new mxCell('', new mxGeometry(27.5, 60, 45, 60), 'line;strokeWidth=1;direction=south;html=1;');
          cell2.vertex = true;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_ER_QBGH') { //全部概化
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 60), 'triangle;whiteSpace=wrap;html=1;direction=south;');
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(35, -24, 30, 24), 'shape=partialRectangle;whiteSpace=wrap;html=1;top=0;bottom=0;fillColor=none;');
          cell1.vertex = true;
          cell.insert(cell1);
          var cell2 = new mxCell('', new mxGeometry(25, 60, 45, 60), 'line;strokeWidth=1;direction=south;html=1;');
          cell2.vertex = true;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DEPLOYMENT_NODE') { //节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 150, 130),
            'verticalAlign=top;align=left;spacingTop=8;spacingLeft=2;spacingRight=12;shape=cube;size=10;direction=south;fontStyle=0;html=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_DEPLOYMENT_DEPLOYMEN') { //配置图 组件
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 80), 'html=1;whiteSpace=wrap;dropTarget=0;aspect=fixed;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(-10, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);

          var cell2 = new mxCell('', new mxGeometry(-10, 50, 20, 15), 'whiteSpace=wrap;html=1;fontSize=17;aspect=fixed;');
          cell2.vertex = true;
          cell2.connectable = false;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_COMPONENT_COMPONENT') { //组件图 组件
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 80), 'html=1;whiteSpace=wrap;dropTarget=0;aspect=fixed;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(-10, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);

          var cell2 = new mxCell('', new mxGeometry(-10, 50, 20, 15), 'whiteSpace=wrap;html=1;fontSize=17;aspect=fixed;');
          cell2.vertex = true;
          cell2.connectable = false;
          cell.insert(cell2);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_COMPONENT_INTERFACE') { //接口
        if (obj.getAttribute('sysMLRectangle') == '1' && display != 'LABEL_TIME_BUSINESS') {
          var className = obj.children[0].getAttribute('name');
          var objName = className;
          if (obj.getAttribute('class_flag') == '1') {
            objName = className + "的实例";
          }
          style = 'shape=rect;html=1;overflow=fill;whiteSpace=wrap;align=center;';
          var label = '<p style="margin:0px;margin-top:4px;text-align:center;">' +
            '&lt;&lt;' + className + '&gt;&gt;<br/>' +
            '<b>' + objName + '</b></p><hr/>' +
            '<p style="margin:0px;margin-left:8px;text-align:left;">' +
            '名称="' + objName + '..."</p>';
          obj.children[0].setAttribute("label", label);
          objType = "sysMLRectangle";
          fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
        if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
          style += 'container=1;'
        }
        fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'UML_COMPONENT_PORT') { //端口
        fns.push(this.addEntry('', function () { //小方块栓
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 10),
            'rounded=0;html=1;verticalAlign=top;align=center;labelPosition=center;verticalLabelPosition=bottom;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_PACKAGE') { //包
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 90, 60),
            'shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=15;tabPosition=left;html=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'UML_COMPONENT_ARTIFACT') { //制品
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 140, 105),
            'swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=0;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;verticalAlign=bottom;labelPosition=center;verticalLabelPosition=top;align=center;');
          cell.vertex = true;
          cell.insert(getField("&lt;&lt;artifact&gt;&gt;"));
          var divider1 = new mxCell('', new mxGeometry(0, 0, 0, 1), 'line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;');
          divider1.vertex = true;
          divider1.connectable = false;
          cell.insert(divider1.clone());
          cell.insert(getField(''));
          cell.insert(divider1.clone());
          cell.insert(getField(''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_KUAIJIEDIAN') { //块节点
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          let type = 'block'
          style = 'html=1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;gradientDirection:west;verticalAlign=top;align=left;container=1;';

          var label = '<div style="width: 100%;"><p style="padding:5px 0 7px 0;margin:0px;text-align:center;">' +
            '&lt;&lt;' + type + '&gt;&gt;<br style="margin-top:0px;/>' +
            '/p><hr/>' + '<p style="margin:0px;margin-left:8px;text-align:left; font-weight: 700">' + className + '</p></div>';
          obj.children[0].setAttribute("label", label);

          objType = "sysMLRectangle";
          if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
            style += 'container=1;';
          }
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style, objType);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 130, 110)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_BUJIAN') { //部件引用
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          var label = `<div style="box-sizing: border-box;width: 100%;height:40px;line-height: 40px;"><div style="margin: 0px ; text-align: center"><b style="font-weight: 700">${className}</b></div></div>`

          obj.children[0].setAttribute("label", label);

          objType = "sysMLRectangle";
          style = 'html=1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;gradientDirection:west;verticalAlign=top;align=left;container=1;';

          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style, objType);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 130, 78)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_INTERNALMODULE_ZUCHENGJIEDIAN') { //组成节点
        var className = obj.children[0].getAttribute('name');
        var objName = className;
        if (obj.getAttribute('class_flag') == '1') {
          objName = className + "的实例";
        }
        style = 'html=1;shape=mxgraph.sysml.port1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;verticalAlign=top;align=left;';
        var label = '<div style="padding:0 20px "><p style="margin:0px;margin-top:4px;text-align:center;">' +
          '&lt;&lt;' + className + '&gt;&gt;<br/>' +
          '<b>' + objName + '</b></p><hr/>' +
          '<p style="margin:0px;margin-left:8px;text-align:left;">' +
          '名称="' + objName + '..."</p></div>';
        obj.children[0].setAttribute("label", label);
        objType = "sysMLRectangle";
        fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
          style += 'container=1;';
          fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
      } else if (display === 'SYSML_PARAMETRIC_YUESHUSHUXINGJIEDIAN') { //约束属性节点
        fns.push(this.addEntry('', function () { //Attribute
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, width, height),
            'rounded=1;whiteSpace=wrap;html=1;gradientColor=#ffffff;gradientDirection=east;strokeColor=#CCCCCC;fillColor=#fff;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_ZHIJIEDIAN') { //值类型节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;valueType&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PARAMETRIC_YUESHUJIEDIAN') { //约束节点
        var className = obj.children[0].getAttribute('name');
        var objName = className;
        if (obj.getAttribute('class_flag') == '1') {
          objName = className + "的实例";
        }
        style = 'html=1;shape=mxgraph.sysml.port1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;verticalAlign=top;align=left;';
        var label = '<div style="padding:0 20px "><p style="margin:0px;margin-top:4px;text-align:center;">' +
          '&lt;&lt;' + className + '&gt;&gt;<br/>' +
          '<b>' + objName + '</b></p><hr/>' +
          '<p style="margin:0px;margin-left:8px;text-align:left;">' +
          '名称="' + objName + '..."</p></div>';
        obj.children[0].setAttribute("label", label);
        objType = "sysMLRectangle";
        fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
          style += 'container=1;';
          fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
      } else if (display === 'SYSML_PARAMETRIC_ZUCHENGJIEDIAN') { //引用部件
        var className = obj.children[0].getAttribute('name');
        var objName = className;
        if (obj.getAttribute('class_flag') == '1') {
          objName = className + "的实例";
        }
        style = 'html=1;shape=mxgraph.sysml.port1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;verticalAlign=top;align=left;';
        var label = '<div style="padding:0 20px "><p style="margin:0px;margin-top:4px;text-align:center;">' +
          '&lt;&lt;' + className + '&gt;&gt;<br/>' +
          '<b>' + objName + '</b></p><hr/>' +
          '<p style="margin:0px;margin-left:8px;text-align:left;">' +
          '名称="' + objName + '..."</p></div>';
        obj.children[0].setAttribute("label", label);
        objType = "sysMLRectangle";
        fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
          style += 'container=1;';
          fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
      } else if (display === 'SYSML_BLOCKDEFINITION_ENUMJIEDIAN') { //枚举节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;enumeration&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_INTERFACEKUAIJIEDIAN') { //接口块节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;interfaceBlock&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_INTERFACEJIEDIAN') { //接口节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40), 'html=1;whiteSpace=wrap;dropTarget=0;aspect=fixed;gradientColor=#fff;gradientDirection:west;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(83, 3, 12, 12), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;shadow=0;opacity=80;part=1;resizable=0;editable=0;cloneable=0;gradientColor=#fff;gradientDirection:west;rotatable=0;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell.insert(cell1);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_XINHAOJIEDIAN') { //信号节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          var text = new mxCell('&lt;&lt;interface&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.vertex = true;
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_KUAIJIEKOUFENQU') { //块节点的接口分区
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;block&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_WANZHENGPORTJIEDIAN') { //完整端口节点
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;gradientColor=#fff;gradientDirection:west;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_BLOCKDEFINITION_DAILIPORTJIEDIAN') { //代理端口节点
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;gradientColor=#fff;gradientDirection:west;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_INTERNALMODULE_PORTJIEDIAN') { //端口节点
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_INTERNALMODULE_LIUPORTJIEDIAN') { //流端口节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 20, 20),
            'strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;');
          var edgeLeft = new mxCell('', new mxGeometry(0, 0, 0, 0), 'endArrow=open;html=1;shadow=0;strokeColor=#000000;strokeWidth=1;endFill=0;fontSize=1;spacing=0;jumpSize=0;jumpStyle=arc;startSize=0;endSize=3;movable=0');
          edgeLeft.edge = true;
          edgeLeft.geometry.setTerminalPoint(new mxPoint(7, 10), true);
          edgeLeft.geometry.setTerminalPoint(new mxPoint(0, 10), false);
          edgeLeft.geometry.relative = true;

          var edgeRight = new mxCell('', new mxGeometry(0, 0, 0, 0), 'endArrow=open;html=1;shadow=0;strokeColor=#000000;strokeWidth=1;endFill=0;fontSize=1;spacing=0;jumpSize=0;jumpStyle=arc;startSize=0;endSize=3;movable=0');
          edgeRight.edge = true;
          edgeRight.geometry.setTerminalPoint(new mxPoint(13, 10), true);
          edgeRight.geometry.setTerminalPoint(new mxPoint(20, 10), false);
          edgeRight.geometry.relative = true;
          cell.insert(edgeLeft);
          cell.insert(edgeRight);
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_INTERNALMODULE_WANZHENGPORTJIEDIAN') { //完整端口节点
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0],[0.5,0,0],[0.5,0.5,0],[0.5,1,0]];html=1;resizable=1;align=right;gradientColor=#fff;gradientDirection:west;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_INTERNALMODULE_DAILIPORTJIEDIAN') { //代理端口节点
        fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=rect;points=[[0,0.5,0]];html=1;resizable=1;align=right;' +
          'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_BLOCKDEFINITION_DAIJIEKOUDAILIPORTJIEDIAN') { //带接口的代理端口节点
        obj.children[0].setAttribute("label", "");
        fns.push(this.createVertexTemplateEntry(style, parseInt(30), parseInt(30), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
      } else if (display === 'SYSML_BLOCKDEFINITION_DAIYUESUFENQUKUAIJIEDIAN') { //带约束分区的块节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;block&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_YUESUKUAIJIEDIAN') { //约束块节点
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');

          var label = '<div style="width: 100%;"><p style="padding:5px 0 7px 0;margin:0px;text-align:center;">' +
            '&lt;&lt;' + 'block' + '&gt;&gt;<br style="margin-top:0px;/>' +
            '/p><hr/>' + '<p style="margin:0px;margin-left:8px;text-align:left; font-weight: 700">' + className + '</p></div>';
          obj.children[0].setAttribute("label", label);

          objType = "sysMLRectangle";
          style = 'html=1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;verticalAlign=top;align=left;container=1;container=1;gradientColor=#fff;';

          if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
            style += 'container=1;';
          }
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style, objType);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 130, 78)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_HUODONGJIEDIAN') { //活动节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;activity&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_SHILIGUIFANJIEDIAN') { //实例规范节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;');
          cell.vertex = true;
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_SHULIANGZHONGLEIJIEDIAN') { //数量种类节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;');
          cell.vertex = true;
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_BLOCKDEFINITION_DANWEIJIEDIAN') { //单位节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=0;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;');
          cell.vertex = true;
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_COMMENT') { //注释说明
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_BIANJIE') { //时序图边界
        fns.push(this.addEntry(obj.children[0], function () {
          // var cell = new mxCell('', new mxGeometry(0, 0, 130, 300), 'group');
          // cell.vertex = true;
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 300), 'shape=umlLifeline;perimeter=lifelinePerimeter;verticalLabelPosition=middle;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;');
          // cell2.geometry.offset = new mxPoint(8, 30);
          // cell2.geometry.relative = true;
          // cell2.parent = cell;
          cell.vertex = true;
          var cell1 = new mxCell('', new mxGeometry(0, 0, 40, 30), 'shape=umlActor;labelBackgroundColor=#ffffff;verticalAlign=top;html=1;outlineConnect=1;part=1;');
          cell1.geometry.offset = new mxPoint(30, -35);
          cell1.geometry.relative = true;
          // cell1.parent = cell;
          cell1.connectable = false;
          cell1.vertex = true;
          // cell.insert(cell1);
          // cell.insert(cell2);
          cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_YUANSUZU') { //元素组
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 80),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;elementGroup&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_PACKAGE_BAOJIEDIAN') { //包节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 90, 60),
            'shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=15;tabPosition=left;html=1;container=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_CHIXUQIGUANCHABIAOJI') { //持续期观察标记
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 100), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_CHIXUQIYUESHUBIAOSHI') { //持续期约束标识
        fns.push(this.addEntry('', function () {
          var edge = new mxCell(obj.children[0], new mxGeometry(0, 0, 0, 0),
            'endArrow=open;endFill=0;endSize=14;html=1;startArrow=open;startFill=0;rounded=0;');
          edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
          edge.geometry.setTerminalPoint(new mxPoint(0, 100), false);
          edge.geometry.relative = true;
          edge.edge = true;
          // var text = new mxCell('&lt;&lt;number&gt;&gt;min', new mxGeometry(-0.5, 10, 60, 10), 'text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;aspect=fixed;');
          // text.vertex = true;
          // text.geometry.relative = true;
          // edge.insert(text);
          return sb.createEdgeTemplateFromCells([edge], 100, 0, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_SHIKEGUANCHABIAOSHI') { //时刻观察标识
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 100), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_SHIKEYUESHUBIAOSHI') { //时刻约束标识
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 10, 100), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_CSWZTJD') { //初始伪状态节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 25, 25), 'noLabel=1;ellipse;html=1;shape=startState;fillColor=#000000;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          /**
          var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
          edge.geometry.setTerminalPoint(new mxPoint(5, 10), true); //start
          edge.geometry.setTerminalPoint(new mxPoint(5, 40), false); //end
          edge.geometry.relative = true;
          edge.edge = true;
          cell.insert(edge);
           */
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_USECASE_YLJD') { //用例节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 110, 60), 'ellipse;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=middle;');
          cell.vertex = true;
          // var edge3 = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=none;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;aspect=fixed;');
          // edge3.geometry.setTerminalPoint(new mxPoint(18, 20), true);  //start
          // edge3.geometry.setTerminalPoint(new mxPoint(172, 20), false);  //end
          // edge3.geometry.relative = true;
          // edge3.edge = true;
          // cell.insert(edge3);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_USECASE_ZTJD') { //主体节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 400, 300), 'rounded=0;html=1;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;');
          cell.vertex = true;
          // var cell1 = new mxCell('', new mxGeometry(50, 30, 80,30),'ellipse;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=top;');
          // cell1.vertex = true;
          // cell.insert(cell1);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_XQJD') { //需求节点
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          let type = 'block'
          style = 'html=1;fontStyle=1;spacingRight=10;whiteSpace=wrap;overflow=fill;gradientDirection:west;verticalAlign=top;align=left;container=1;';
          var label = '<div style="width: 100%;"><p style="padding:5px 0 7px 0;margin:0px;text-align:center;">' +
            '&lt;&lt;' + type + '&gt;&gt;<br style="margin-top:0px;/>' +
            '/p><hr/>' + '<p style="margin:0px;margin-left:8px;text-align:left; font-weight: 700">' + className + '</p></div>';
          obj.children[0].setAttribute("label", label);
          objType = "sysMLRectangle";
          if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
            style += 'container=1;';
          }
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style, objType);
          cell.vertex = true;
          cell.geometry.alternateBounds = new mxRectangle(0, 0, 150, 40)
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_XQGLLXJD') { //需求关联类型节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 90),
            'swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=0;marginBottom=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;ElementType&gt;&gt;', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=bottom;whiteSpace=wrap;rounded=0;labelPosition=center;verticalLabelPosition=top;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          cell.insert(field.clone());
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          cell.insert(divider.clone());
          cell.insert(sb.cloneCell(field, ''));
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_ZSFQ') { //追溯分区
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40), 'rounded=0;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_CSYLJD') { //测试用例节点
        fns.push(this.addEntry('', function () {
          var className = obj.children[0].getAttribute('name');
          let type = 'block'
          style = 'ellipse;whiteSpace=wrap;html=1;fontStyle=1;gradientDirection:west;labelPosition=center;';

          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_ZSBZ') { //追溯标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;ElementType&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_PSBZ') { //派生标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;requirement&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_YZBZ') { //验证标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;requirement&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_MZBZ') { //满足标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;ElementType&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_JHBZ') { //精化标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;fillColor=#E6E6E6;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;requirement&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_ZXQBZ') { //主需求标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 120, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;requirement&gt;&gt;', new mxGeometry(0, 0, 120, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_YJBZ') { //依据标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;rationale&gt;&gt;', new mxGeometry(0, 0, 100, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fitWidth=1;fitWidth=1;');
          text.vertex = true;
          text.connectable = false;
          cell.insert(text);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_WTBZ') { //问题标注
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 40),
            'shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;size=11;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          var text = new mxCell('&lt;&lt;problem&gt;&gt;', new mxGeometry(0, 0, 100, 20), 'html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;fontStyle=1;points=[];connectable=0;rotatable=0;movable=0;cloneable=0;resizable=0;rounded=0;editable=0;fitWidth=1;');
          text.vertex = true;
          text.geometry.relative = true
          cell.insert(text);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_REQUIREMENT_BJD') { //包节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 90, 60),
            'shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=15;tabPosition=left;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;container=1;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'COMPLETECLASSIFICATION') { //完全分类图形
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 50, 20),
            'rounded=0;whiteSpace=wrap;html=1;strokeColor=none;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 10, 50, 10),
            'shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;fillColor=none;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell1.noInsert = true;
          cell.insert(cell1);

          var circle = new mxCell('', new mxGeometry(20, 0, 10, 10), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=none;');
          circle.vertex = true;
          circle.connectable = false;
          circle.noInsert = true;
          cell.insert(circle);

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'NONCOMPLETECLASSIFICATION') { //非完全分类图形
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 50, 10),
            'rounded=0;whiteSpace=wrap;html=1;strokeColor=none;');
          cell.vertex = true;

          var cell1 = new mxCell('', new mxGeometry(0, 10, 50, 1),
            'line;strokeWidth=1;html=1;');
          cell1.vertex = true;
          cell1.connectable = false;
          cell1.noInsert = true;
          cell.insert(cell1);

          var circle = new mxCell('', new mxGeometry(20, 0, 10, 10), 'ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=none;');
          circle.vertex = true;
          circle.connectable = false;
          circle.noInsert = true;
          cell.insert(circle);
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JIBENDONGZUOJIEDIAN') { //基本动作节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 100, 60), 'shape=rect;html=1;rounded=1;whiteSpace=wrap;align=center;arcSize=15;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_CHUSHIJIEDIAN') { //初始节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 40, 40), 'noLabel=1;ellipse;html=1;aspect=fixed;fillColor=#000000;align=center;verticalAlign=top;rounded=0;labelPosition=center;verticalLabelPosition=bottom;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_STATEMACHINE_FSXHJD') { //发送信号节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 140, 35), 'html=1;shape=mxgraph.sysml.sendSigAct;strokeWidth=1;whiteSpace=wrap;align=center;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_YHUIHEJIEDIAN') { //汇合节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 5), 'rounded=1;html=1;fillColor=#000000;direction=south;strokeWidth=1;perimeterSpacing=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JIESHOUSHIJIANDONGZUOJIEDIAN') { //接收事件动作节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 35), 'html=1;shape=mxgraph.sysml.accEvent;strokeWidth=1;whiteSpace=wrap;align=center;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_ACTIVITY_JUECEJIEDIAN') { //决策节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 30, 30), 'rhombus;html=1;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;align=center;verticalAlign=middle;rounded=0;');
          cell.vertex = true;
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'LABEL_DENGDAISHIJIANDONGZUO') { // 等待时间动作
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, width, height),
            'html=1;shape=mxgraph.sysml.timeEvent;strokeWidth=2;verticalLabelPosition=bottom;verticalAlignment=top;');
          cell.vertex = true;
          cell.value.setAttribute('label', '');
          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_DUOFENQUPIANDUANJIEDIAN') { //多分区片段节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'html=1;shape=mxgraph.sysml.package;labelX=40;whiteSpace=wrap;align=center;strokeWidth=1;');
          cell.vertex = true;

          const ref = new mxCell('par', new mxGeometry(0, 0), 'html=1;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
          ref.vertex = true
          ref.geometry.offset = new mxPoint(5, 0);
          ref.geometry.relative = true
          ref.connectable = '0'
          cell.insert(ref);

          var text1 = new mxCell('[]', new mxGeometry(0, 0, 170, 20), 'text;html=1;autosize=1;autosizeHeight=1;resizable=0;movable=0;connectable=0;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text1.geometry.offset = new mxPoint(5, 30)
          text1.vertex = true
          text1.geometry.relative = true;
          cell.insert(text1)

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else if (display === 'SYSML_SEQUENCE_JIAOHUSHIYONGJIEDIAN') { //交互使用节点
        fns.push(this.addEntry('', function () {
          var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'html=1;shape=mxgraph.sysml.package;labelX=40;;whiteSpace=wrap;align=center;strokeWidth=1;');
          cell.vertex = true;

          const ref = new mxCell('Opt', new mxGeometry(0, 0), 'html=1;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
          ref.vertex = true
          ref.geometry.offset = new mxPoint(5, 0);
          ref.geometry.relative = true
          ref.connectable = '0'
          cell.insert(ref);

          var text1 = new mxCell('[]', new mxGeometry(0, 0, 170, 20), 'text;autosize=1;autosizeHeight=1;resizable=1;movable=0;connectable=0;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
          text1.geometry.offset = new mxPoint(5, 30)
          text1.vertex = true
          text1.geometry.relative = true;
          cell.insert(text1)

          return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
        }));
      } else {
        if (obj.children[0].getAttribute('sysMLRectangle') == '1' && display != 'LABEL_TIME_BUSINESS') {
          var className = obj.children[0].getAttribute('name');
          var objName = "";
          if (obj.children[0].getAttribute('class_flag') == '1' && display != 'LABEL_TIME_BUSINESS') {
            objName = className + "的实例";
          }
          objType = "sysMLRectangle";
          style = 'shape=rect;html=1;overflow=fill;whiteSpace=wrap;align=center;';
          var label = '<p style="margin:0px;margin-top:4px;text-align:center;">' +
            '&lt;&lt;' + className + '&gt;&gt;<br/>' +
            '<b>' + objName + '</b></p><hr/>' +
            '<p style="margin:0px;margin-left:8px;text-align:left;">' +
            '名称="' + objName + '..."</p>';
          obj.children[0].setAttribute("label", label);
          fns.push(this.createVertexTemplateEntry(style, parseInt(160), parseInt(220), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        } else if (display === 'SYSML_SEQUENCE_GUOLVPIANDUANJIEDIAN') { //过滤片段节点
          fns.push(this.addEntry('', function () {
            var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 160), 'shape=umlFrame;whiteSpace=wrap;html=1;noLabel=1;');
            cell.value.setAttribute('label', '')
            const title = new mxCell('alt', new mxGeometry(0, 0), 'html=1;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
            title.vertex = true
            title.geometry.offset = new mxPoint(5, 0);
            title.geometry.relative = true
            title.connectable = '0'
            cell.insert(title);

            cell.vertex = true;

            var text1 = new mxCell('if', new mxGeometry(0, 0, 170, 20), 'text;html=1;autosize=1;resizable=0;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
            text1.geometry.offset = new mxPoint(5, 30)
            text1.vertex = true
            text1.geometry.relative = true;
            cell.insert(text1)
            var text2 = new mxCell('else', new mxGeometry(0, 0, 170, 20), 'text;html=1;autosize=1;resizable=0;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
            text2.geometry.offset = new mxPoint(5, 90)
            text2.vertex = true
            text2.geometry.relative = true;
            cell.insert(text2)
            var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=none;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=1;aspect=fixed;');
            edge.geometry.setTerminalPoint(new mxPoint(180, 80), true);
            edge.geometry.setTerminalPoint(new mxPoint(0, 80), false);
            edge.geometry.relative = true;
            edge.edge = true;
            cell.insert(edge);
            return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
          }));
        } else if (display === 'SYSML_ACTIVITY_FENZHIJIEDIAN') { //分支节点
          fns.push(this.addEntry('', function () {
            var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 5, 160), 'rounded=1;html=1;fillColor=#000000;direction=south;strokeWidth=1;perimeterSpacing=0;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
            cell.vertex = true;
            // var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=open;startSize=10;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;dashed=0;aspect=fixed;');
            // edge.geometry.setTerminalPoint(new mxPoint(-50, 35), true);  //start
            // edge.geometry.setTerminalPoint(new mxPoint(0, 35), false);  //end
            // edge.geometry.relative = true;
            // edge.edge = true;
            // cell.insert(edge);
            return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
          }));
        } else if (display === 'SYSML_SEQUENCE_LOOPXUNHUAN') { //loop循环
          fns.push(this.addEntry('', function () {
            var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 180, 100), 'html=1;shape=mxgraph.sysml.package;labelX=40;whiteSpace=wrap;align=center;strokeWidth=1;');
            cell.vertex = true;

            const ref = new mxCell('loop', new mxGeometry(0, 0), 'html=1;align=left;verticalAlign=top;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;spacingLeft=5;spacingTop=-2;fontStyle=1;', '')
            ref.vertex = true
            ref.geometry.offset = new mxPoint(5, 0);
            ref.geometry.relative = true
            ref.connectable = '0'
            cell.insert(ref);

            var text1 = new mxCell('[]', new mxGeometry(0, 0, 170, 20), 'text;autosize=1;autosizeHeight=1;resizable=1;movable=0;connectable=0;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;', 'text textbox textarea label')
            text1.geometry.offset = new mxPoint(5, 30)
            text1.vertex = true
            text1.geometry.relative = true;
            cell.insert(text1)

            return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
          }));
        } else if (display === 'SYSML_ACTIVITY_HUODONGJIESHUJIEDIAN') { //活动结束节点
          fns.push(this.addEntry('', function () {
            var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 40, 40), 'noLabel=1;ellipse;html=1;shape=endState;fillColor=#000000;strokeColor=#000000;labelPosition=center;verticalLabelPosition=bottom;align=center;verticalAlign=top;');
            cell.vertex = true;
            return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
          }));
        } else if (display === 'LABEL_ER_ENTITY') {
          let er;
          for (let i = 0; i < objectList.length; i++) {
            const obj = objectList[i];
            const displayNode = this.getDisplay(obj.children[0].getAttribute('display'));
            const display = displayNode.getAttribute('display');
            if (display === 'LABEL_ER_ATTRIBUTE') {
              window.LABELERATTRIBUTE = obj.children[0];
              er = obj.children[0];
              break
            }
          }

          fns.push(this.addEntry('', function () {
            var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 80), 'rounded=0;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=top;align=center;verticalAlign=bottom;');
            cell.vertex = true;

            var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=none;startFill=0;endArrow=none;startSize=8;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;rounded=1;aspect=fixed;');
            edge.geometry.setTerminalPoint(new mxPoint(0, 20), true); //start
            edge.geometry.setTerminalPoint(new mxPoint(160, 20), false); //end
            edge.geometry.relative = true;
            edge.connectable = false;
            edge.edge = true;
            edge.inside = true; //标记为内部画的线
            cell.insert(edge);
            return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
          }));
        } else if (display === 'LABEL_INPUTPIN') { // 入栓
          fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=mxgraph.sysml.inputPin;points=[[0,0.5,0]];html=1;resizable=1;align=right;' +
            'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        } else if (display === 'LABEL_OUTPIN') { // 出栓
          fns.push(this.createVertexTemplateEntry('strokeColor=inherit;fillColor=inherit;gradientColor=inherit;shape=mxgraph.sysml.outPin;points=[[0,0.5,0]];html=1;resizable=1;align=right;' +
            'verticalAlign=bottom;labelPosition=left;verticalLabelPosition=top;labelBackgroundColor=none;fontSize=10;', parseInt(20), parseInt(20), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        } else if (display === 'SYSML_ACTIVITY_FASONGXINHAODONGZUO') { //发送信号动作
          fns.push(this.addEntry('', function () {
            var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 35), 'html=1;shape=mxgraph.sysml.sendSigAct;strokeWidth=1;whiteSpace=wrap;align=center;');
            cell.vertex = true;
            return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
          }));
        } else if (display === 'LABEL_RECTANGLE') { //流程规范
          fns.push(this.addEntry('', function () {
            var className = obj.children[0].getAttribute('name');
            let type = '';
            style = 'html=1;fontStyle=1;whiteSpace=wrap;verticalAlign=middle;align=center;container=1;';
            var label = '<div style="width: 100%;"><p style="padding:5px 0 7px 0;margin:0px;text-align:center;">' +
              '&lt;&lt;' + type + '&gt;&gt;<br style="margin-top:0px;/>' +
              '/p><hr/>' + '<p style="margin:0px;margin-left:8px;text-align:left; font-weight: 700">' + className + '</p></div>';
            obj.children[0].setAttribute("label", label);
            var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, parseInt(width), parseInt(height)), style);
            cell.vertex = true;
            cell.geometry.alternateBounds = new mxRectangle(0, 0, 150, 40)
            return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
          }));
        } else if (display === 'SYSML_ACTIVITY_DIAOYONGDONGZUOJIEDIAN') { //调用动作节点
          fns.push(this.addEntry('', function () {
            var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 160, 50), 'shape=rect;html=1;rounded=1;whiteSpace=wrap;arcSize=15;dropTarget=0;aspect=fixed;');
            cell.geometry.relative = true
            cell.vertex = true;

            var cell1 = new mxCell('→', new mxGeometry(-10, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;connectable=0;movable=0;rotatable=0;');
            cell1.vertex = true;
            cell.insert(cell1);

            var cell2 = new mxCell('→', new mxGeometry(150, 15, 20, 15), 'whiteSpace=wrap;html=1;aspect=fixed;connectable=0;movable=0;rotatable=0;');
            cell2.vertex = true;
            cell.insert(cell2);
            return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'));
          }));
        } else {
          if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
            style += 'container=1;';
          }
          fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
        }
      }
    }

    // 时间轴
    if (obj.getAttribute('type') == "TIMEAXIS") {
      window.defaultEdgeStyle = {
        'endArrow': 'none',
        'edgeStyle': 'orthogonalEdgeStyle',
        'html': '1',
        'entryPerimeter': '0',
        'exitX': '1',
        'exitY': '0.5',
        'entryY': '0'
      };
      if (!window.connectableEdges) {
        window.connectableEdges = true;
      };
      var currentDisplay = displayNode.getAttribute('style');
      var currentObject = obj.children[0];
      var currentWidth = width;
      fns.push(this.addEntry('', function () {
        var cell = new mxCell(obj.children[0], new mxGeometry(0, 0, 750, 35), 'rounded=0;endArrow=classic;whiteSpace=wrap;html=1;collapsible=0;recursiveResize=0;outlineConnect=1;display=flexArrow;rotatable=0;')
        cell.vertex = true
        return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, obj.getAttribute('tooltip'))
      }));
      // fns.push(this.createEdgeTemplateEntry('endArrow=none;html=1;', 50, 50, '', '', null, null));
    }

    // 分组
    if (obj.getAttribute('type') == "GROUP") {
      var groupObject = obj;
      fns.push(this.addEntry('', function () {
        const memberList = []
        var objectMap = {};
        var mainObjectDisplay = sb.getDisplay(groupObject.children[0].getAttribute('display'));
        var mainObject = new mxCell(groupObject.children[0], new mxGeometry(0, 0, parseInt(mainObjectDisplay.getAttribute('w')), parseInt(mainObjectDisplay.getAttribute('h'))), mainObjectDisplay.getAttribute('style'));
        mainObject.vertex = true;
        memberList.push(mainObject)
        objectMap[groupObject.getAttribute('id')] = mainObject;
        // [宽，高，x偏移量，y偏移量]
        const groupSize = [mainObject.geometry.width, mainObject.geometry.height, 0, 0]

        $.each(groupObject.children, function (index, currentObj) {
          if (currentObj.nodeName == 'entity') {
            return true;
          }
          var display = sb.getDisplay(currentObj.children[0].getAttribute('display'));
          if (currentObj.nodeName == 'objects') {
            var xdqy = currentObj.getAttribute('xdqy');
            var x = currentObj.getAttribute('x') * 1;
            var y = currentObj.getAttribute('y') * 1;
            if (xdqy == 'left') {
              groupSize[0] += (x + parseInt(display.getAttribute('w')))
              x = x * -1 - parseInt(display.getAttribute('w'))
              groupSize[2] = Math.min(groupSize[2], x)
            } else if (xdqy == 'up') {
              groupSize[1] += (y + parseInt(display.getAttribute('h')))
              y = y * -1 - parseInt(display.getAttribute('h'))
              groupSize[3] = Math.min(groupSize[3], y)
            } else if (xdqy == 'right') {
              groupSize[0] += (x + parseInt(display.getAttribute('w')))
              x = x + parseInt(mainObjectDisplay.getAttribute('w'));
            } else if (xdqy == 'down') {
              groupSize[1] += (y + parseInt(display.getAttribute('h')))
              y = y + parseInt(mainObjectDisplay.getAttribute('h'));
            }

            let objectStyle = display.getAttribute('style')
            if (display.getAttribute('display') === 'LABEL_DOWN_T') {
              const points = []
              Array.from({
                length: 20
              }).forEach((item, index) => {
                points.push([0.3, (index * 0.05).toFixed(1), 0])
              })
              Array.from({
                length: 20
              }).forEach((item, index) => {
                points.push([0.7, (index * 0.05).toFixed(1), 0])
              })
              objectStyle += `points=${JSON.stringify(points)};`
            }

            var cell = new mxCell(currentObj.children[0], new mxGeometry(x, y, parseInt(display.getAttribute('w')), parseInt(display.getAttribute('h'))), objectStyle);
            cell.vertex = true;
            memberList.push(cell)
            objectMap[currentObj.getAttribute('id')] = cell;
          } else if (currentObj.nodeName == 'lines') {
            var style = display.getAttribute('style');
            if (currentObj.getAttribute('sourceId') == groupObject.getAttribute('id')) {
              style += 'entryX=0.5;entryY=0.5;entryPerimeter=0;'
            } else if (currentObj.getAttribute('targetId') == groupObject.getAttribute('id')) {
              style += 'exitX=0.5;exitY=0.5;exitPerimeter=0;';
            }
            var edge = new mxCell(currentObj.children[0], new mxGeometry(0, 0, parseInt(display.getAttribute('w')), 0), style);
            edge.geometry.relative = true;
            edge.source = objectMap[currentObj.getAttribute('sourceId')];
            edge.target = objectMap[currentObj.getAttribute('targetId')];
            edge.edge = true;
            memberList.push(edge)
          }
        })
        window.isSetingGraphXml = true
        const d = new mxRectangle(groupSize[2], groupSize[3], groupSize[0], groupSize[1])
        const container = sb.editorUi.editor.graph.groupCells(null, 0, memberList, d)
        window.isSetingGraphXml = false
        return sb.createVertexTemplateFromCells([container], parseInt(mainObjectDisplay.getAttribute('w')), parseInt(mainObjectDisplay.getAttribute('h')), groupObject.getAttribute('tooltip'));
      }));
    }
  }

  return fns
}

/**
 * 添加工具调色板到侧边栏。
 * 创建选择工具和连续创建工具，提供基本的编辑功能。
 */
Sidebar.prototype.addToolPalette = function () {
  window.isPokePatttern = false;
  const tools = [this.addEntry('', function () {
    const mouse = document.createElement('div')
    const svg = document.createElement('img')
    svg.id = 'sidebarTool_select'
    svg.src = 'img/icon/object/选择.svg'
    mouse.style.display = 'inline-flex'
    // mouse.style.color = window.isPokePatttern ? '#000' : '#facc78' D:\项目\203\KD-WEB-VUE-BUSINESS\static\drawio\
    mouse.appendChild(svg)
    mouse.addEventListener('click', (evt) => {
      if (myEditor.editor.graph.connectionHandler.isConnecting() === true) {
        myEditor.editor.graph.connectionHandler.destroyIcons();
        mxEvent.consume(evt);
        window.myEditor.graphEvent.exitAddPattern()
        myEditor.editor.graph.connectionHandler.reset();
      }
      window.isPokePatttern = false
      window.myEditor.graphEvent.exitAddPattern()
    })
    return mouse;
  }), this.addEntry('', mxUtils.bind(this, function () {
    const poke = document.createElement('div')
    poke.style.display = 'inline-flex'

    poke.style.marginLeft = '10px'
    // poke.style.color = window.isPokePatttern ? '#facc78' : '#000'
    const svg = document.createElement('img')
    svg.id = 'sidebarTool_poke'
    svg.src = 'img/icon/object/戳记.svg'
    poke.appendChild(svg)
    poke.title = '连续创建'

    poke.addEventListener('click', () => {
      window.myEditor.graphEvent.exitAddPattern()
      window.isPokePatttern = !window.isPokePatttern
      this.updateToolStatus()
    })
    return poke;
  }))]
  this.addPaletteFunctions('toolSelect', mxResources.get('toolSelect'), true, tools);
  this.updateToolStatus()
}

/**
 * 更新工具状态的显示。
 * 根据当前连续创建模式的状态更新工具按钮的视觉样式。
 */
Sidebar.prototype.updateToolStatus = function () {
  const tool_select = document.getElementById('sidebarTool_select')
  const tool_poke = document.getElementById('sidebarTool_poke')
  if (tool_select) {
    tool_select.style.backgroundColor = window.isPokePatttern ? '#fff' : '#facc78'
  }
  if (tool_poke) {
    tool_poke.style.backgroundColor = window.isPokePatttern ? '#facc78' : '#fff'
  }
}

/**
 * 添加绘图组件调色板到侧边栏。
 * 根据XML配置创建各种图形元素和关系的调色板，支持动态加载和分组显示。
 *
 * @param {boolean} expand - 是否初始展开调色板
 */
Sidebar.prototype.addDiagramPalette = function (expand) {
  window.saveCell = true
  window.showThumb = true
  // 此处不太理解为啥要这么写，原型链上的属性与实例上的实际不是同一个了；此处的清空是不起作用的
  // 如若改成 this.cellAndStyleMap = [] 则会有bug，在模型树中的quote元素新建会执行此函数导致被此数组被清空，导致恢复样式功能等出现问题
  Sidebar.prototype.cellAndStyleMap = []
  try {
    // sysml
    if (window.objectXmlMap) {
      const xmlMap = JSON.parse(window.objectXmlMap)
      const keys = Object.keys(xmlMap)

      if (window.isGuideModel) {
        const relationXml = '<?xml version="1.0" encoding="UTF-8"?><root><model tooltip="" type="META_RELATIONSHIP"><relation business="BUSINESS_NORMAL"  display="LINE_ORDINARY_NODE" name="关系线" tooltip="关系线" label="" type="META_RELATIONSHIP" objectId="" name_en="关系线"/></model></root>'
        this.addPaletteFunctions('关系', '关系', (expand != null) ? expand : false, this.createFns(relationXml));
        keys.splice(keys.indexOf('视图', 1))
        keys.unshift('视图')
      }

      keys.forEach(key => {
        console.log(key);
        if (key === '') {
          const fns = this.createFns(xmlMap[key])
          fns && fns.length && this.addPaletteFunctions('createModel', mxResources.get('createModel'), (expand != null) ? expand : false, fns);
        } else {
          const fns = this.createFns(xmlMap[key])
          fns && fns.length && this.addPaletteFunctions(key, key, (expand != null) ? expand : false, fns);
        }
      })
    }
    if (window.zTreeObj && window.zTreeObj.currentSelectedNode && window.zTreeObj.currentSelectedNode.type === 'mind_map') {
      this.setCurrentSearchEntryLibrary('general', 'general');
      const relationXml = '<?xml version="1.0" encoding="UTF-8"?><root><model tooltip="关系线" type="META_RELATIONSHIP"><relation business="BUSINESS_NORMAL"  display="LINE_ORDINARY_NODE" name="关系线" tooltip="关系线" label="" type="META_RELATIONSHIP" objectId="" showEditData="false" name_en="关系线"/></model><model type="META_ENTITY" tooltip="主题"><entity metaId="" display="LABEL_ZHUTI" name="主题"  sLabel="主题"  tooltip="主题" label="主题" objectId=""/></model></root>'
      this.addPaletteFunctions('通用', '通用', (expand != null) ? expand : false, this.createFns(relationXml));
      this.setCurrentSearchEntryLibrary();
    }
  } catch (error) {
    console.error(error)
    // objectXml 是在页面定义变量（从后台获取）
    const fns = this.createFns(window.objectXml)
    // 建模元素
    fns && fns.length && this.addPaletteFunctions('createModel', mxResources.get('createModel'), (expand != null) ? expand : false, fns);
  }
};

/**
 * 添加数据定义调色板到侧边栏。
 * 从服务器获取实体数据列表，为每个实体创建对应的调色板函数。
 *
 * @param {boolean} expand - 是否初始展开调色板
 */
Sidebar.prototype.addDataDefinition = async function (expand) {

  const entityData = [];

  await window.$axios.get(contextPath + "/difine/findEntityListByModelId", {
    params: {
      modelId: modelId //页面定义 modelId
    }
  }).then((responseText) => {
    if (responseText && responseText.statusCode === 200) {
      $.each(responseText.data, function (index, entity) {
        entityData.push(entity);
      })
    }
  }).catch(e => {
    console.log("ajax fail.");
  })

  for (let i = 0; i < entityData.length; i++) {
    const entity = entityData[i];
    console.log(entity);
    this.addDataDefinitionPaletteFunctions(entity, (expand != null) ? expand : true);
  }
}

/**
 * 添加领域模型调色板到侧边栏。
 * 从服务器获取领域实体数据，筛选特定类型的实体创建调色板。
 *
 * @param {boolean} expand - 是否初始展开调色板
 */
Sidebar.prototype.addDomainModel = async function (expand) {

  if (!isFzPage) {

    const entityDomainData = [];
    await window.$axios.get(contextPath + "/difine/entitylist_all", {}).then((responseText) => {
      if (responseText && responseText.statusCode === 200) {
        $.each(responseText.data, function (index, entity) {
          //console.log(entity.objectName);
          const objectName = entity.objectName;
          if (objectName === "能力" || objectName === "作战节点" || objectName === "作战活动" || objectName === "作战任务" || objectName === "服务" || objectName === "服务功能" ||
            objectName === "服务接口" || objectName === "系统" || objectName === "系统功能" || objectName === "系统接口" || objectName === "应用APP" || objectName === "服务组件" ||
            objectName === "数据链" || objectName === "机载总线" || objectName === "接入方式" || objectName === "资源") {
            entityDomainData.push(entity);
          }
        })
      }
    }).catch(e => {
      console.log("ajax fail.");
    })
    for (let i = 0; i < entityDomainData.length; i++) {
      const entity = entityDomainData[i];
      this.addDomainPaletteFunctions(entity, (expand != null) ? expand : true);
    }

  }

}

/**
 * 添加图片图标调色板到侧边栏。
 * 从图片存储服务获取图片资源，为每种图片类型创建对应的调色板。
 *
 * @param {boolean} expand - 是否初始展开调色板
 */
Sidebar.prototype.addPictureIcon = async function (expand) {

  const pictureData = [];

  //图片大类
  await window.$axios.post(contextPath + "/pictureStore/listPicture", {}).then((responseText) => {
    if (responseText && responseText.statusCode === 200) {
      $.each(responseText.data, function (index, row) {
        pictureData.push(row);
      })
    }
  }).catch(e => {
    console.log("ajax fail.");
  })

  for (let i = 0; i < pictureData.length; i++) {
    const entity = pictureData[i];
    this.addPicturePaletteFunctions(entity, (expand != null) ? expand : true);
  }

}

/**
 * 添加形状搜索用户界面到侧边栏。
 * 创建搜索输入框和结果显示区域，提供图形元素搜索功能。
 *
 * @param {boolean} expand - 是否初始展开搜索调色板
 */
Sidebar.prototype.addSearchPalette = function (expand) {
  var elt = document.createElement('div');
  elt.style.visibility = 'hidden';
  this.container.appendChild(elt);

  var div = document.createElement('div');
  div.className = 'geSidebar';
  div.style.boxSizing = 'border-box';
  div.style.overflow = 'hidden';
  div.style.width = '100%';
  div.style.padding = '8px';
  div.style.paddingTop = '14px';
  div.style.paddingBottom = '0px';

  if (!expand) {
    div.style.display = 'none';
  }

  var inner = document.createElement('div');
  inner.style.whiteSpace = 'nowrap';
  inner.style.textOverflow = 'clip';
  inner.style.paddingBottom = '8px';
  inner.style.cursor = 'default';

  var input = document.createElement('input');
  input.setAttribute('placeholder', mxResources.get('searchShapes'));
  input.setAttribute('type', 'text');
  input.style.fontSize = '12px';
  input.style.overflow = 'hidden';
  input.style.boxSizing = 'border-box';
  input.style.border = 'solid 1px #d5d5d5';
  input.style.borderRadius = '4px';
  input.style.width = '100%';
  input.style.outline = 'none';
  input.style.padding = '6px';
  input.style.paddingRight = '20px';
  inner.appendChild(input);

  var cross = document.createElement('img');
  cross.setAttribute('src', Sidebar.prototype.searchImage);
  cross.setAttribute('title', mxResources.get('search'));
  cross.style.position = 'relative';
  cross.style.left = '-18px';
  cross.style.top = '1px';

  // 在IE中需要阻止事件透明度
  cross.style.background = 'url(\'' + this.editorUi.editor.transparentImage + '\')';

  var find;

  inner.appendChild(cross);
  div.appendChild(inner);

  var center = document.createElement('center');
  var button = mxUtils.button(mxResources.get('moreResults'), function () {
    find();
  });
  button.style.display = 'none';

  // 怪异模式下继承行高的解决方法
  button.style.lineHeight = 'normal';
  button.style.fontSize = '12px';
  button.style.padding = '6px 12px 6px 12px';
  button.style.marginTop = '4px';
  button.style.marginBottom = '8px';
  center.style.paddingTop = '4px';
  center.style.paddingBottom = '4px';

  center.appendChild(button);
  div.appendChild(center);

  var searchTerm = '';
  var active = false;
  var complete = false;
  var page = 0;
  var hash = new Object();

  // 计数将在下面动态更新
  var count = 12;

  var clearDiv = mxUtils.bind(this, function () {
    active = false;
    this.currentSearch = null;
    var child = div.firstChild;

    while (child != null) {
      var next = child.nextSibling;

      if (child != inner && child != center) {
        child.parentNode.removeChild(child);
      }

      child = next;
    }
  });

  mxEvent.addListener(cross, 'click', function () {
    if (cross.getAttribute('src') == Dialog.prototype.closeImage) {
      cross.setAttribute('src', Sidebar.prototype.searchImage);
      cross.setAttribute('title', mxResources.get('search'));
      button.style.display = 'none';
      input.value = '';
      searchTerm = '';
      clearDiv();
    }

    input.focus();
  });

  find = mxUtils.bind(this, function () {
    // 显示4行（最少4个结果）
    count = 4 * Math.max(1, Math.floor(this.container.clientWidth / (this.thumbWidth + 10)));
    this.hideTooltip();

    if (input.value != '') {
      if (center.parentNode != null) {
        if (searchTerm != input.value) {
          clearDiv();
          searchTerm = input.value;
          hash = new Object();
          complete = false;
          page = 0;
        }

        if (!active && !complete) {
          button.setAttribute('disabled', 'true');
          button.style.display = '';
          button.style.cursor = 'wait';
          button.innerHTML = mxResources.get('loading') + '...';
          active = true;

          // 忽略旧的结果
          var current = new Object();
          this.currentSearch = current;

          this.searchEntries(searchTerm, count, page, mxUtils.bind(this, function (results, len, more, terms) {
            if (this.currentSearch == current) {
              results = (results != null) ? results : [];
              active = false;
              page++;
              this.insertSearchHint(div, searchTerm, count, page, results, len, more, terms);

              // 允许重复搜索
              if (results.length == 0 && page == 1) {
                searchTerm = '';
              }

              if (center.parentNode != null) {
                center.parentNode.removeChild(center);
              }

              for (var i = 0; i < results.length; i++) {
                (mxUtils.bind(this, function (result) {
                  try {
                    var elt = result();

                    // 避免结果中出现重复项
                    if (hash[elt.innerHTML] == null) {
                      hash[elt.innerHTML] = (result.parentLibraries != null) ? result.parentLibraries.slice() : [];
                      div.appendChild(elt);
                    } else if (result.parentLibraries != null) {
                      hash[elt.innerHTML] = hash[elt.innerHTML].concat(result.parentLibraries);
                    }

                    mxEvent.addGestureListeners(elt, null, null, mxUtils.bind(this, function (evt) {
                      var libs = hash[elt.innerHTML];

                      if (mxEvent.isPopupTrigger(evt)) {
                        this.showPopupMenuForEntry(elt, libs, evt);
                      }
                    }));

                    // 禁用内置的上下文菜单
                    mxEvent.disableContextMenu(elt);
                  } catch (e) {
                    // ignore
                  }
                }))(results[i]);
              }

              if (more) {
                button.removeAttribute('disabled');
                button.innerHTML = mxResources.get('moreResults');
              } else {
                button.innerHTML = mxResources.get('reset');
                button.style.display = 'none';
                complete = true;
              }

              button.style.cursor = '';
              div.appendChild(center);
            }
          }), mxUtils.bind(this, function () {
            // TODO: 错误处理
            button.style.cursor = '';
          }));
        }
      }
    } else {
      clearDiv();
      input.value = '';
      searchTerm = '';
      hash = new Object();
      button.style.display = 'none';
      complete = false;
      input.focus();
    }
  });

  this.searchShapes = function (value) {
    input.value = value;
    find();
  };

  mxEvent.addListener(input, 'keydown', mxUtils.bind(this, function (evt) {
    if (evt.keyCode == 13 /* Enter */ ) {
      find();
      mxEvent.consume(evt);
    }
  }));

  mxEvent.addListener(input, 'keyup', mxUtils.bind(this, function (evt) {
    if (input.value == '') {
      cross.setAttribute('src', Sidebar.ototype.searchImage);
      cross.setAttribute('title', mxResources.get('search'));
    } else {
      cross.setAttribute('src', Dialog.prototype.closeImage);
      cross.setAttribute('title', mxResources.get('reset'));
    }

    if (input.value == '') {
      complete = true;
      button.style.display = 'none';
    } else if (input.value != searchTerm) {
      button.style.display = 'none';
      complete = false;
    } else if (!active) {
      if (complete) {
        button.style.display = 'none';
      } else {
        button.style.display = '';
      }
    }
  }));

  // 编辑器中阻止文本选择的解决方法
  mxEvent.addListener(input, 'mousedown', function (evt) {
    if (evt.stopPropagation) {
      evt.stopPropagation();
    }

    evt.cancelBubble = true;
  });

  // 编辑器中阻止文本选择的解决方法
  mxEvent.addListener(input, 'selectstart', function (evt) {
    if (evt.stopPropagation) {
      evt.stopPropagation();
    }

    evt.cancelBubble = true;
  });

  var outer = document.createElement('div');
  outer.appendChild(div);
  this.container.appendChild(outer);

  // 保持对DOM节点的引用
  this.palettes['search'] = [elt, outer];
};

/**
 * 在搜索调色板中插入搜索提示信息。
 * 当搜索结果为空时显示相应的提示信息。
 *
 * @param {HTMLElement} div - 插入提示信息的容器元素
 * @param {string} searchTerm - 搜索关键词
 * @param {number} count - 搜索结果总数
 * @param {number} page - 当前页码
 * @param {Array} results - 搜索结果数组
 * @param {number} len - 结果长度
 * @param {boolean} more - 是否有更多结果
 * @param {Array} terms - 搜索词数组
 */
Sidebar.prototype.insertSearchHint = function (div, searchTerm, count, page, results, len, more, terms) {
  if (results.length == 0 && page == 1) {
    var err = document.createElement('div');
    err.className = 'geTitle';
    err.style.cssText = 'background-color:transparent;border-color:transparent;' +
      'color:gray;padding:6px 0px 0px 0px !important;margin:4px 8px 4px 8px;' +
      'text-align:center;cursor:default !important';

    mxUtils.write(err, mxResources.get('noResultsFor', [searchTerm]));
    div.appendChild(err);
  }
};

/**
 * 添加通用调色板到侧边栏。
 * 创建包含基本形状、连接线和常用元素的调色板，提供通用的绘图组件。
 *
 * @param {boolean} expand - 是否初始展开通用调色板
 */
Sidebar.prototype.addGeneralPalette = function (expand) {
  var lineTags = 'line lines connector connectors connection connections arrow arrows ';
  this.setCurrentSearchEntryLibrary('general', 'general');

  var fns = [
    this.createVertexTemplateEntry('rounded=0;whiteSpace=wrap;html=1;', 120, 60, '', '矩形', null, null, 'rect rectangle box'),
    this.createVertexTemplateEntry('rounded=1;whiteSpace=wrap;html=1;', 120, 60, '', '圆角矩形', null, null, 'rounded rect rectangle box'),
    // 显式设置strokecolor/fillcolor=none是为了在当前样式下保持透明背景的解决方法
    this.createVertexTemplateEntry('text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;',
      40, 20, '文字', '文字', null, null, 'text textbox textarea label'),
    this.createVertexTemplateEntry('text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;', 190, 120,
      '<h1>Heading</h1><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>',
      '文本框', null, null, 'text textbox textarea'),
    this.createVertexTemplateEntry('ellipse;whiteSpace=wrap;html=1;', 120, 80, '', '椭圆', null, null, 'oval ellipse state'),
    this.createVertexTemplateEntry('whiteSpace=wrap;html=1;aspect=fixed;', 80, 80, '', '正方形', null, null, 'square'),
    this.createVertexTemplateEntry('ellipse;whiteSpace=wrap;html=1;aspect=fixed;', 80, 80, '', '圆', null, null, 'circle'),
    this.createVertexTemplateEntry('shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;', 120, 60, '', '流程', null, null, 'process task'),
    this.createVertexTemplateEntry('rhombus;whiteSpace=wrap;html=1;', 80, 80, '', '菱形', null, null, 'diamond rhombus if condition decision conditional question test'),
    this.createVertexTemplateEntry('shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;', 120, 60, '', '平行四边形'),
    this.createVertexTemplateEntry('shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;', 120, 80, '', '六边形', null, null, 'hexagon preparation'),
    this.createVertexTemplateEntry('triangle;whiteSpace=wrap;html=1;', 60, 80, '', '三角形', null, null, 'triangle logic inverter buffer'),
    this.createVertexTemplateEntry('shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;', 60, 80, '', '圆柱', null, null, 'cylinder data database'),
    this.createVertexTemplateEntry('ellipse;shape=cloud;whiteSpace=wrap;html=1;', 120, 80, '', '云', null, null, 'cloud network'),
    this.createVertexTemplateEntry('shape=document;whiteSpace=wrap;html=1;boundedLbl=1;', 120, 80, '', '文档'),
    this.createVertexTemplateEntry('shape=internalStorage;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', '内存'),
    this.createVertexTemplateEntry('shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;', 120, 80, '', '立方体'),
    this.createVertexTemplateEntry('shape=step;perimeter=stepPerimeter;whiteSpace=wrap;html=1;fixedSize=1;', 120, 80, '', '步骤'),
    this.createVertexTemplateEntry('shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;', 120, 60, '', '梯形'),
    this.createVertexTemplateEntry('shape=tape;whiteSpace=wrap;html=1;', 120, 100, '', '磁带'),
    this.createVertexTemplateEntry('shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;', 80, 100, '', '注释'),
    this.createVertexTemplateEntry('shape=card;whiteSpace=wrap;html=1;', 80, 100, '', '卡片'),
    this.createVertexTemplateEntry('shape=callout;whiteSpace=wrap;html=1;perimeter=calloutPerimeter;', 120, 80, '', '标识', null, null, 'bubble chat thought speech message'),
    this.createVertexTemplateEntry('shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;', 30, 60, '角色', '角色', false, null, 'user person human stickman'),
    this.createVertexTemplateEntry('shape=xor;whiteSpace=wrap;html=1;', 60, 80, '', '或', null, null, 'logic or'),
    this.createVertexTemplateEntry('shape=or;whiteSpace=wrap;html=1;', 60, 80, '', '与', null, null, 'logic and'),
    this.createVertexTemplateEntry('shape=dataStorage;whiteSpace=wrap;html=1;fixedSize=1;', 100, 80, '', '日期存储器'),
  ];

  // if (window.sidebarStructure && window.sidebarStructure.selectedNodeId) {
  //   const selectRow = sidebarStructure.nodeList.find(i => i.id === sidebarStructure.selectedNodeId)
  //   if (selectRow && selectRow.type === 'mind_map') {
  const relations = [
    this.addEntry('curve', mxUtils.bind(this, function () {
      var cell = new mxCell('', new mxGeometry(0, 0, 50, 50), 'curved=1;endArrow=classic;html=1;');
      cell.geometry.setTerminalPoint(new mxPoint(0, 50), true);
      cell.geometry.setTerminalPoint(new mxPoint(50, 0), false);
      cell.geometry.points = [new mxPoint(50, 50), new mxPoint(0, 0)];
      cell.geometry.relative = true;
      cell.edge = true;

      return this.createEdgeTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '曲线');
    })),
    this.createEdgeTemplateEntry('shape=flexArrow;endArrow=classic;startArrow=classic;html=1;', 50, 50, '', '双向箭头', null, lineTags + 'bidirectional'),
    this.createEdgeTemplateEntry('shape=flexArrow;endArrow=classic;html=1;', 50, 50, '', '箭头', null, lineTags + 'directional directed'),
    this.createEdgeTemplateEntry('endArrow=none;dashed=1;html=1;', 50, 50, '', '虚线', null, lineTags + 'dashed undirected no'),
    this.createEdgeTemplateEntry('endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=2;', 50, 50, '', '点虚线', null, lineTags + 'dotted undirected no'),
    this.createEdgeTemplateEntry('endArrow=none;html=1;', 50, 50, '', '线', null, lineTags + 'simple undirected plain blank no'),
    this.createEdgeTemplateEntry('endArrow=classic;startArrow=classic;html=1;', 50, 50, '', '双向连接器', null, lineTags + 'bidirectional'),
    this.createEdgeTemplateEntry('endArrow=classic;html=1;', 50, 50, '', '定向连接器', null, lineTags + 'directional directed'),
    this.createEdgeTemplateEntry('shape=link;html=1;', 100, 0, '', '链接', null, lineTags + 'link'),
    this.addEntry(lineTags + 'edge title', mxUtils.bind(this, function () {
      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'endArrow=classic;html=1;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(100, 0), false);
      edge.geometry.relative = true;
      edge.edge = true;

      var cell0 = new mxCell('标签', new mxGeometry(0, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;');
      cell0.geometry.relative = true;
      cell0.setConnectable(false);
      cell0.vertex = true;
      edge.insert(cell0);

      return this.createEdgeTemplateFromCells([edge], 100, 0, '带标签的连接器');
    })),
    this.addEntry(lineTags + 'edge title multiplicity', mxUtils.bind(this, function () {
      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'endArrow=classic;html=1;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(160, 0), false);
      edge.geometry.relative = true;
      edge.edge = true;

      var cell0 = new mxCell('标签', new mxGeometry(0, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;');
      cell0.geometry.relative = true;
      cell0.setConnectable(false);
      cell0.vertex = true;
      edge.insert(cell0);

      var cell1 = new mxCell('来源', new mxGeometry(-1, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=left;verticalAlign=bottom;');
      cell1.geometry.relative = true;
      cell1.setConnectable(false);
      cell1.vertex = true;
      edge.insert(cell1);

      return this.createEdgeTemplateFromCells([edge], 160, 0, '带两标签的连接器');
    })),
    this.addEntry(lineTags + 'edge title multiplicity', mxUtils.bind(this, function () {
      var edge = new mxCell('Label', new mxGeometry(0, 0, 0, 0), 'endArrow=classic;html=1;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(160, 0), false);
      edge.geometry.relative = true;
      edge.edge = true;

      var cell0 = new mxCell('标签', new mxGeometry(0, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=center;verticalAlign=middle;');
      cell0.geometry.relative = true;
      cell0.setConnectable(false);
      cell0.vertex = true;
      edge.insert(cell0);

      var cell1 = new mxCell('来源', new mxGeometry(-1, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=left;verticalAlign=bottom;');
      cell1.geometry.relative = true;
      cell1.setConnectable(false);
      cell1.vertex = true;
      edge.insert(cell1);

      var cell2 = new mxCell('目标', new mxGeometry(1, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=right;verticalAlign=bottom;');
      cell2.geometry.relative = true;
      cell2.setConnectable(false);
      cell2.vertex = true;
      edge.insert(cell2);

      return this.createEdgeTemplateFromCells([edge], 160, 0, '带三标签的连接器');
    })),
    this.addEntry(lineTags + 'edge shape symbol message mail email', mxUtils.bind(this, function () {
      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'endArrow=classic;html=1;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(100, 0), false);
      edge.geometry.relative = true;
      edge.edge = true;

      var cell = new mxCell('', new mxGeometry(0, 0, 20, 14), 'shape=message;html=1;outlineConnect=0;');
      cell.geometry.relative = true;
      cell.vertex = true;
      cell.geometry.offset = new mxPoint(-10, -7);
      edge.insert(cell);

      return this.createEdgeTemplateFromCells([edge], 100, 0, '带符号的连接器');
    }))
  ]
  fns.push(...relations)
  //   }
  // }

  this.addPaletteFunctions('general', mxResources.get('general'), (expand != null) ? expand : true, fns);
  this.setCurrentSearchEntryLibrary();
};

/**
 * 添加杂项调色板到侧边栏。
 * 创建包含标题、注释和特殊形状等杂项元素的调色板。
 *
 * @param {boolean} expand - 是否初始展开杂项调色板
 */
Sidebar.prototype.addMiscPalette = function (expand) {
  var sb = this;
  var lineTags = 'line lines connector connectors connection connections arrow arrows '
  this.setCurrentSearchEntryLibrary('general', 'misc');

  var fns = [
    this.createVertexTemplateEntry('text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;', 100, 40, 'Title', 'Title', null, null, 'text heading title'),
    this.createVertexTemplateEntry('text;strokeColor=none;fillColor=none;html=1;whiteSpace=wrap;verticalAlign=middle;overflow=hidden;', 100, 80,
      '<ul><li>Value 1</li><li>Value 2</li><li>Value 3</li></ul>', 'Unordered List'),
    this.createVertexTemplateEntry('text;strokeColor=none;fillColor=none;html=1;whiteSpace=wrap;verticalAlign=middle;overflow=hidden;', 100, 80,
      '<ol><li>Value 1</li><li>Value 2</li><li>Value 3</li></ol>', 'Ordered List'),
    this.addDataEntry('table', 180, 120, 'Table 1', '7ZjJTsMwEIafJleUhZZybVgucAFewDTT2pLjiewpaXl6xolLVQFqWBJArZRKns2xv5H7y4myvFxdW1HJWyxAR9lllOUWkdpRucpB6yiNVRFlF1GaxvyL0qsPokkTjSthwVCXgrQteBJ6Ca2ndTha6+BwUlR+SOLRu6aSSl7mRcLDWiqC+0rMfLzmTbDPkbB0r569K2Z7hoaEMmBDzQy1FpVTzWRthlS6uBFrXNLmNRtrGpYHlmD14RYbV9jfNWAJZNecUquCZMiYtBhiCWohN2WBTSxc61i81m6J8SBAex9g1h0gL5mU0HcwI2EWXVi+ZVVYrB6EXQAFR4XKENjLJ6bhgm+utM5Ro0du0PgXEVYhqGG+qX1EIiyDYQOY10kbKKMpP4wpj09G0Yh3k7OdbG1+fLqlHI0jy432c4BwVIPr3MD0aw08/YH+nfbbP2N89rZ/324NMsq5xppNqYoCTFfG2V7G454Qjw4c8WoX7wDEx0fiO3/wAyA/O+pAbzqw3m3TELIwOZQTdPZrsnB+4IiHl4UkPiIfWheS5CgMfQvDZEBhSD5xY/7fZyjZf63u7dD0fKv++5B/QRwO5ia8h3mP6sDm9tNeE9v58vcC'),
    this.addDataEntry('table', 180, 120, 'Table 2', '7ZjBbqMwEIafhmuFISTptbTbS/eyrfbuBie2ZDzITEqyT79jMMlGWVTUBlqVSkTyjGeM+SbDLxPEab67t7yQPyETOojvgji1ANiM8l0qtA6iUGVBfBtEUUi/IPrRMcvq2bDgVhjskxA1CS9cb0XjaRwl7rV3lJIXboj82bluJOa0zVtGw0oqFI8FX7n5ih6CfCVyi4/qj3OFZK/AIFdGWJ+zAq15Uap6sSZCKp098D1ssb1Na7nobW4eKL/00Raqf02/f2FR7DoZ1C4P4F5ALtDuKaRSGUofsWw4hVKojWzTPLyQl41jc8g9IqWBp/p/wnF/wrRlVFz/EivkZtMH9jnMzELxxO1GoHcUoAwKe/dCNFpoa6V1ChpcTQwYdyOEwk9qsW5znwER8ha8B3NYtIaS3NBFmNLwKgkSepqUbHa06XLhFlMwJVr6J7g1BC+xEiX2LWD0tgLOLlC/2Vn9ftfDKGQXLaQxLvpYyHfXCIjpWkNFplRZJkxf2PGrsOcDsU46WV+2aT49690p5xHQzzvRx5NEf3j3j8B+8S0Rg0nE/rRMYyjGsrOVZl+0lRYfphjXnayTabEeXzFY2Ml+Pkn2Y0oGY9+aMbRmLEfUDHZ+EG+bafFFm4m9fiofrHvOD+Ut7eXEaH+AbnSfqK+nCX9A4SDz+DGxnjv51vgX'),
    this.addDataEntry('table title', 180, 120, 'Table with Title 1', '7ZhRb6MwDMc/Da8nAmPdvZbu9nJ7WfcFMnAhUohR4o12n34OpKumrmqlDXa6VqJS/Lcdkp8bWSFK82Z9Z2Vb32MJOkpvozS3iDSMmnUOWkdJrMooXURJEvMvSv4c8IreG7fSgqFTEpIh4UXqZxiUR/mkYVAdbXRQXS1bP6Tem85ranitC8HDrlYEy1YW3t/xTlhzJC0t1auX0piFAg1JZcCGpAK1lq1T/WyLPqJWuvwrN/hM2/dsrfmKs5dhMT5balUZHhe8Sz/lPOwCLMH6IIleChjuABsgu+GQTpVUh4ibgVZcg6rqbVoWROkGoXrP3YHlQWD7Oed0j/NBxLxkUlI/QEHSVKfQ3odZWmwfpa2AgtCi8qhuX5iGC9pKaZ2jRl8Tg8a/iLANTg2rbe4TEmETDBvAvE/aQ8nm/DCmPP6VRRnvJmdb7Gx+fLilHI0jy/8EPwdIRx04OrWAyecF3ATEoUzH6nn1DeW8GrecxvjoXTm/XClksiuNHZu1KkswpyJPj56Z65EQZ2eOeP0R7wTEry/E+4RkOuSzS1sYuy3MJmwLN+dygmY/1hZ+nzni6duCiC/Ip+4LQlwaw9iNQYgJO4PYv2j/p4dIHL9mj3ZqRr5l//uQf6A7nM1V+AjzEdsDm7svgr3vwwfDNw=='),
    this.addDataEntry('table title', 180, 150, 'Table with Title 2', '7Zhdb5swFIZ/DbcTHyVrbiFdb7Kbptq9Cw5YMj7IPi1kv37HYJK1FDWbQoOmSUSyz4dt3id+L/CitGrvNavL75Bz6UV3XpRqAOxHVZtyKb3QF7kXbbww9Onnhd8mskGX9WumucJzGsK+4YXJZ95HHtmT5H3U4EG6qClZbYfYZaOkxIrOuglo2JQC+a5mmc039CYUM8g07sRPG4p8CmSgkAnFtWvKQEpWG9GttukqSiHzLTvAMw77DLNkL1qeP0BjXLeGZkuLGde6p8V37qw2zaQoFI0zEsHumLiX5Bp5OylUF3Iq3XOoOOoDlTQix9JV3PZi+iUXRTm0xS7ITB8ojr0n3WngpH8fQzTCMEmAjoyCyQeeIVPFOTDGWuca6kemC44uUIOwUt29kBpHVYWUKUiwyBQouxFC7ZKS74feJ0CEaiDjhDku2okSJ/SQTKn/JfZiepuU5sFpTo8t15iCMqjpj2LX4Mxgww2eCzB8H+DBSewwfcQzugDOmxHO4KI8lbLVJ55/jMp/gwpI2r2EhqalyHOuztU8+vDS3MykcTzS+Ec3DP2Faz24U1+bGNpQqGLbd65mgNG+BvH7BZgLzupf8LO34JblZ6tP9LOvI5yX5bkcP1tdzc9uJ/1s4VrP52cTMK7gZ+v/fja3n60/0c8Cf8QzWvYl++s7tL6aoQXBpKMtXOz5HG2CxvyORtPTR4Uu9+qbwy8='),
    this.addDataEntry('crossfunctional cross-functional cross functional flowchart swimlane table', 400, 400, 'Cross-Functional Flowchart', '7ZhRb5swEMc/DY+bMCRt97jQpi+tVC2fwINbbMnYyD4C6aefjaHpBrTRlNCoTALJPp9t+P25O5kgTvL6XtOCPaoMRBDfBXGilULfyusEhAiikGdBfBtEUWjvIFqPjJJmNCyoBonHTIj8hB0VJXiL3dyYL+tSpsiVpM55LVSVMqrROxvci9bZMFq4JtKfzrRKGRfZA92rEjtr11tpVT1wCcYOhM5ViTKXry0G7RYb/uwWXDgDw9wCuSW2WTGOsClo6gYri8uvIGhheLN1s4KGtNSG7+AHGL+Os0JdUJm1nUJxiaDvdhZQt/EvJXHTvpTbjAq+lbadgnO1hhYSaIR6FHRjainfg8oB9d66VDxD5j0WoRcjZMC3DP8yUuMN25e5B91so5VuWMa4J+P3FJW2JtLXrOK5oNLJxZTmz/blqXhNp3mO5cpe9smS8OsyWNp5ie2TQ99ezl1joqRBTXmDAajBCgxejprHKBcNK7fvBPIz3hOSRCcQctET8olRA+8JmSopIW2j8GOD6Sji8TDxepT4C9yTE1+OEo/mQ5xcTYn8ahR5PB/k0c2UyK9HC8SbX/mnLBAnqAlD8XK+onDTE+/fw+TiQF9fTin4Nl/O0xYAEs6X9LR5n5Ae6S7xv1lr/yf+4cQ/pN75Ej/pH88/UZyQkRPzR6R+0j9Bz4f0xMm/f8adD+qzZn/bPfw5bMb++LH4Gw=='),
    this.createVertexTemplateEntry('text;html=1;strokeColor=#c0c0c0;fillColor=#ffffff;overflow=fill;rounded=0;', 280, 160,
      '<table border="1" width="100%" height="100%" cellpadding="4" style="width:100%;height:100%;border-collapse:collapse;">' +
      '<tr style="background-color:#A7C942;color:#ffffff;border:1px solid #98bf21;"><th align="left">Title 1</th><th align="left">Title 2</th><th align="left">Title 3</th></tr>' +
      '<tr style="border:1px solid #98bf21;"><td>Value 1</td><td>Value 2</td><td>Value 3</td></tr>' +
      '<tr style="background-color:#EAF2D3;border:1px solid #98bf21;"><td>Value 4</td><td>Value 5</td><td>Value 6</td></tr>' +
      '<tr style="border:1px solid #98bf21;"><td>Value 7</td><td>Value 8</td><td>Value 9</td></tr>' +
      '<tr style="background-color:#EAF2D3;border:1px solid #98bf21;"><td>Value 10</td><td>Value 11</td><td>Value 12</td></tr></table>', 'HTML Table 1'),
    this.createVertexTemplateEntry('text;html=1;strokeColor=#c0c0c0;fillColor=none;overflow=fill;', 180, 140,
      '<table border="0" width="100%" height="100%" style="width:100%;height:100%;border-collapse:collapse;">' +
      '<tr><td align="center">Value 1</td><td align="center">Value 2</td><td align="center">Value 3</td></tr>' +
      '<tr><td align="center">Value 4</td><td align="center">Value 5</td><td align="center">Value 6</td></tr>' +
      '<tr><td align="center">Value 7</td><td align="center">Value 8</td><td align="center">Value 9</td></tr></table>', 'HTML Table 2'),
    this.createVertexTemplateEntry('text;html=1;strokeColor=none;fillColor=none;overflow=fill;', 180, 140,
      '<table border="1" width="100%" height="100%" style="width:100%;height:100%;border-collapse:collapse;">' +
      '<tr><td align="center">Value 1</td><td align="center">Value 2</td><td align="center">Value 3</td></tr>' +
      '<tr><td align="center">Value 4</td><td align="center">Value 5</td><td align="center">Value 6</td></tr>' +
      '<tr><td align="center">Value 7</td><td align="center">Value 8</td><td align="center">Value 9</td></tr></table>', 'HTML Table 3'),
    this.createVertexTemplateEntry('text;html=1;strokeColor=none;fillColor=none;overflow=fill;', 160, 140,
      '<table border="1" width="100%" height="100%" cellpadding="4" style="width:100%;height:100%;border-collapse:collapse;">' +
      '<tr><th align="center"><b>Title</b></th></tr>' +
      '<tr><td align="center">Section 1.1\nSection 1.2\nSection 1.3</td></tr>' +
      '<tr><td align="center">Section 2.1\nSection 2.2\nSection 2.3</td></tr></table>', 'HTML Table 4'),
    this.addEntry('link hyperlink', mxUtils.bind(this, function () {
      var cell = new mxCell('Link', new mxGeometry(0, 0, 60, 40), 'text;html=1;strokeColor=none;fillColor=none;whiteSpace=wrap;align=center;verticalAlign=middle;fontColor=#0000EE;fontStyle=4;');
      cell.vertex = true;
      this.graph.setLinkForCell(cell, 'https://www.draw.io');

      return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Link');
    })),
    this.addEntry('timestamp date time text label', mxUtils.bind(this, function () {
      var cell = new mxCell('%date{ddd mmm dd yyyy HH:MM:ss}%', new mxGeometry(0, 0, 160, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;');
      cell.vertex = true;
      this.graph.setAttributeForCell(cell, 'placeholders', '1');

      return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Timestamp');
    })),
    this.addEntry('variable placeholder metadata hello world text label', mxUtils.bind(this, function () {
      var cell = new mxCell('%name% Text', new mxGeometry(0, 0, 80, 20), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;');
      cell.vertex = true;
      this.graph.setAttributeForCell(cell, 'placeholders', '1');
      this.graph.setAttributeForCell(cell, 'name', 'Variable');

      return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Variable');
    })),
    this.createVertexTemplateEntry('shape=ext;double=1;rounded=0;whiteSpace=wrap;html=1;', 120, 80, '', 'Double Rectangle', null, null, 'rect rectangle box double'),
    this.createVertexTemplateEntry('shape=ext;double=1;rounded=1;whiteSpace=wrap;html=1;', 120, 80, '', 'Double Rounded Rectangle', null, null, 'rounded rect rectangle box double'),
    this.createVertexTemplateEntry('ellipse;shape=doubleEllipse;whiteSpace=wrap;html=1;', 100, 60, '', 'Double Ellipse', null, null, 'oval ellipse start end state double'),
    this.createVertexTemplateEntry('shape=ext;double=1;whiteSpace=wrap;html=1;aspect=fixed;', 80, 80, '', 'Double Square', null, null, 'double square'),
    this.createVertexTemplateEntry('ellipse;shape=doubleEllipse;whiteSpace=wrap;html=1;aspect=fixed;', 80, 80, '', 'Double Circle', null, null, 'double circle'),
    this.createVertexTemplateEntry('rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillWeight=4;hachureGap=8;hachureAngle=45;fillColor=#1ba1e2;sketch=1;', 120, 60, '', 'Rectangle Sketch', true, null, 'rectangle rect box text sketch comic retro'),
    this.createVertexTemplateEntry('ellipse;whiteSpace=wrap;html=1;strokeWidth=2;fillWeight=2;hachureGap=8;fillColor=#990000;fillStyle=dots;sketch=1;', 120, 60, '', 'Ellipse Sketch', true, null, 'ellipse oval sketch comic retro'),
    this.createVertexTemplateEntry('rhombus;whiteSpace=wrap;html=1;strokeWidth=2;fillWeight=-1;hachureGap=8;fillStyle=cross-hatch;fillColor=#006600;sketch=1;', 120, 60, '', 'Diamond Sketch', true, null, 'diamond sketch comic retro'),
    this.createVertexTemplateEntry('html=1;whiteSpace=wrap;shape=isoCube2;backgroundOutline=1;isoAngle=15;', 90, 100, '', 'Isometric Cube', true, null, 'cube box iso isometric'),
    this.createVertexTemplateEntry('html=1;whiteSpace=wrap;aspect=fixed;shape=isoRectangle;', 150, 90, '', 'Isometric Square', true, null, 'rectangle rect box iso isometric'),
    this.createEdgeTemplateEntry('edgeStyle=isometricEdgeStyle;endArrow=none;html=1;', 50, 100, '', 'Isometric Edge 1'),
    this.createEdgeTemplateEntry('edgeStyle=isometricEdgeStyle;endArrow=none;html=1;elbow=vertical;', 50, 100, '', 'Isometric Edge 2'),
    this.createVertexTemplateEntry('shape=curlyBracket;whiteSpace=wrap;html=1;rounded=1;', 20, 120, '', 'Curly Bracket'),
    this.createVertexTemplateEntry('line;strokeWidth=2;html=1;', 160, 10, '', 'Horizontal Line'),
    this.createVertexTemplateEntry('line;strokeWidth=2;direction=south;html=1;', 10, 160, '', 'Vertical Line'),
    this.createVertexTemplateEntry('line;strokeWidth=4;html=1;perimeter=backbonePerimeter;points=[];outlineConnect=0;', 160, 10, '', 'Horizontal Backbone', false, null, 'backbone bus network'),
    this.createVertexTemplateEntry('line;strokeWidth=4;direction=south;html=1;perimeter=backbonePerimeter;points=[];outlineConnect=0;', 10, 160, '', 'Vertical Backbone', false, null, 'backbone bus network'),
    this.createVertexTemplateEntry('shape=crossbar;whiteSpace=wrap;html=1;rounded=1;', 120, 20, '', 'Crossbar', false, null, 'crossbar distance measure dimension unit'),
    this.createVertexTemplateEntry('shape=image;html=1;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=1;aspect=fixed;image=' + this.gearImage, 52, 61, '', 'Image (Fixed Aspect)', false, null, 'fixed image icon symbol'),
    this.createVertexTemplateEntry('shape=image;html=1;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;image=' + this.gearImage, 50, 60, '', 'Image (Variable Aspect)', false, null, 'strechted image icon symbol'),
    this.createVertexTemplateEntry('icon;html=1;image=' + this.gearImage, 60, 60, 'Icon', 'Icon', false, null, 'icon image symbol'),
    this.createVertexTemplateEntry('label;whiteSpace=wrap;html=1;image=' + this.gearImage, 140, 60, 'Label', 'Label 1', null, null, 'label image icon symbol'),
    this.createVertexTemplateEntry('label;whiteSpace=wrap;html=1;align=center;verticalAlign=bottom;spacingLeft=0;spacingBottom=4;imageAlign=center;imageVerticalAlign=top;image=' + this.gearImage, 120, 80, 'Label', 'Label 2', null, null, 'label image icon symbol'),
    this.addEntry('shape group container', function () {
      var cell = new mxCell('Label', new mxGeometry(0, 0, 160, 70),
        'html=1;whiteSpace=wrap;container=1;recursiveResize=0;collapsible=0;');
      cell.vertex = true;

      var symbol = new mxCell('', new mxGeometry(20, 20, 20, 30), 'triangle;html=1;whiteSpace=wrap;');
      symbol.vertex = true;
      cell.insert(symbol);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Shape Group');
    }),
    this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;left=0;right=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
    this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;bottom=1;right=1;left=1;top=0;fillColor=none;routingCenterX=-0.5;', 120, 60, '', 'Partial Rectangle'),
    this.createEdgeTemplateEntry('edgeStyle=segmentEdgeStyle;endArrow=classic;html=1;', 50, 50, '', 'Manual Line', null, lineTags + 'manual'),
    this.createEdgeTemplateEntry('shape=filledEdge;rounded=0;fixDash=1;endArrow=none;strokeWidth=10;fillColor=#ffffff;edgeStyle=orthogonalEdgeStyle;', 60, 40, '', 'Filled Edge'),
    this.createEdgeTemplateEntry('edgeStyle=elbowEdgeStyle;elbow=horizontal;endArrow=classic;html=1;', 50, 50, '', 'Horizontal Elbow', null, lineTags + 'elbow horizontal'),
    this.createEdgeTemplateEntry('edgeStyle=elbowEdgeStyle;elbow=vertical;endArrow=classic;html=1;', 50, 50, '', 'Vertical Elbow', null, lineTags + 'elbow vertical')
  ];

  this.addPaletteFunctions('misc', mxResources.get('misc'), (expand != null) ? expand : true, fns);
  this.setCurrentSearchEntryLibrary();
};
/**
 * Adds the container palette to the sidebar.
 */
Sidebar.prototype.addAdvancedPalette = function (expand) {
  this.setCurrentSearchEntryLibrary('general', 'advanced');
  this.addPaletteFunctions('advanced', mxResources.get('advanced'), (expand != null) ? expand : false, this.createAdvancedShapes());
  this.setCurrentSearchEntryLibrary();
};

/**
 * Adds the general palette to the sidebar.
 */
Sidebar.prototype.addBasicPalette = function (dir) {
  this.setCurrentSearchEntryLibrary('basic');
  this.addStencilPalette('basic', mxResources.get('basic'), dir + '/basic.xml',
    ';whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=2',
    null, null, null, null, [
      this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;bottom=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
      this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;right=0;top=0;bottom=0;fillColor=none;routingCenterX=-0.5;', 120, 60, '', 'Partial Rectangle'),
      this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;bottom=0;right=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
      this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;left=0;fillColor=none;', 120, 60, '', 'Partial Rectangle')
    ]);
  this.setCurrentSearchEntryLibrary();
};

/**
 * Adds the container palette to the sidebar.
 */
Sidebar.prototype.createAdvancedShapes = function () {
  // 避免需要将所有函数绑定到"this"
  var sb = this;

  // 可重用的单元格
  var field = new mxCell('List Item', new mxGeometry(0, 0, 60, 26), 'text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;');
  field.vertex = true;

  return [
    this.createVertexTemplateEntry('shape=tapeData;whiteSpace=wrap;html=1;perimeter=ellipsePerimeter;', 80, 80, '', 'Tape Data'),
    this.createVertexTemplateEntry('shape=manualInput;whiteSpace=wrap;html=1;', 80, 80, '', 'Manual Input'),
    this.createVertexTemplateEntry('shape=loopLimit;whiteSpace=wrap;html=1;', 100, 80, '', 'Loop Limit'),
    this.createVertexTemplateEntry('shape=offPageConnector;whiteSpace=wrap;html=1;', 80, 80, '', 'Off Page Connector'),
    this.createVertexTemplateEntry('shape=delay;whiteSpace=wrap;html=1;', 80, 40, '', 'Delay'),
    this.createVertexTemplateEntry('shape=display;whiteSpace=wrap;html=1;', 80, 40, '', 'Display'),
    this.createVertexTemplateEntry('shape=singleArrow;direction=west;whiteSpace=wrap;html=1;', 100, 60, '', 'Arrow Left'),
    this.createVertexTemplateEntry('shape=singleArrow;whiteSpace=wrap;html=1;', 100, 60, '', 'Arrow Right'),
    this.createVertexTemplateEntry('shape=singleArrow;direction=north;whiteSpace=wrap;html=1;', 60, 100, '', 'Arrow Up'),
    this.createVertexTemplateEntry('shape=singleArrow;direction=south;whiteSpace=wrap;html=1;', 60, 100, '', 'Arrow Down'),
    this.createVertexTemplateEntry('shape=doubleArrow;whiteSpace=wrap;html=1;', 100, 60, '', 'Double Arrow'),
    this.createVertexTemplateEntry('shape=doubleArrow;direction=south;whiteSpace=wrap;html=1;', 60, 100, '', 'Double Arrow Vertical', null, null, 'double arrow'),
    this.createVertexTemplateEntry('shape=actor;whiteSpace=wrap;html=1;', 40, 60, '', 'User', null, null, 'user person human'),
    this.createVertexTemplateEntry('shape=cross;whiteSpace=wrap;html=1;', 80, 80, '', 'Cross'),
    this.createVertexTemplateEntry('shape=corner;whiteSpace=wrap;html=1;', 80, 80, '', 'Corner'),
    this.createVertexTemplateEntry('shape=tee;whiteSpace=wrap;html=1;', 80, 80, '', 'Tee'),
    this.createVertexTemplateEntry('shape=datastore;whiteSpace=wrap;html=1;', 60, 60, '', 'Data Store', null, null, 'data store cylinder database'),
    this.createVertexTemplateEntry('shape=orEllipse;perimeter=ellipsePerimeter;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', 'Or', null, null, 'or circle oval ellipse'),
    this.createVertexTemplateEntry('shape=sumEllipse;perimeter=ellipsePerimeter;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', 'Sum', null, null, 'sum circle oval ellipse'),
    this.createVertexTemplateEntry('shape=lineEllipse;perimeter=ellipsePerimeter;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', 'Ellipse with horizontal divider', null, null, 'circle oval ellipse'),
    this.createVertexTemplateEntry('shape=lineEllipse;line=vertical;perimeter=ellipsePerimeter;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', 'Ellipse with vertical divider', null, null, 'circle oval ellipse'),
    this.createVertexTemplateEntry('shape=sortShape;perimeter=rhombusPerimeter;whiteSpace=wrap;html=1;', 80, 80, '', 'Sort', null, null, 'sort'),
    this.createVertexTemplateEntry('shape=collate;whiteSpace=wrap;html=1;', 80, 80, '', 'Collate', null, null, 'collate'),
    this.createVertexTemplateEntry('shape=switch;whiteSpace=wrap;html=1;', 60, 60, '', 'Switch', null, null, 'switch router'),
    this.addEntry('process bar', function () {
      return sb.createVertexTemplateFromData('zZXRaoMwFIafJpcDjbNrb2233rRQ8AkyPdPQaCRJV+3T7yTG2rUVBoOtgpDzn/xJzncCIdGyateKNeVW5iBI9EqipZLS9KOqXYIQhAY8J9GKUBrgT+jbRDZ02aBhCmrzEwPtDZ9MHKBXdkpmoDWKCVN9VptO+Kw+8kqwGqMkK7nIN6yTB7uTNizbD1FSSsVPsjYMC1qFKHxwIZZSSIVxLZ1/nJNar5+oQPMT7IYCrqUta1ENzuqGaeOFTArBGs3f3Vmtoo2Se7ja1h00kSoHK4bBIKUNy3hdoPYU0mF91i9mT8EEL2ocZ3gKa00ayWujLZY4IfHKFonVDLsRGgXuQ90zBmWgneyTk3yT1iArMKrDKUeem9L3ajHrbSXwohxsQd/ggOleKM7ese048J2/fwuim1uQGmhQCW8vQMkacP3GCQgBFMftHEsr7cYYe95CnmKTPMFbYD8CQ++DGQy+/M5X4ku5wHYmdIktfvk9tecpavThqS3m/0YtnqIWPTy1cD77K2wYjo+Ay317I74A', 296, 100, 'Process Bar');
    }),
    this.createVertexTemplateEntry('swimlane;', 200, 200, 'Container', 'Container', null, null, 'container swimlane lane pool group'),
    this.addEntry('list group erd table', function () {
      var cell = new mxCell('List', new mxGeometry(0, 0, 140, 110),
        'swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;' +
        'resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;');
      cell.vertex = true;
      cell.insert(sb.cloneCell(field, 'Item 1'));
      cell.insert(sb.cloneCell(field, 'Item 2'));
      cell.insert(sb.cloneCell(field, 'Item 3'));

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'List');
    }),
    this.addEntry('list item entry value group erd table', function () {
      return sb.createVertexTemplateFromCells([sb.cloneCell(field, 'List Item')], field.geometry.width, field.geometry.height, 'List Item');
    })
  ];
};

/**
 * Adds the container palette to the sidebar.
 */
Sidebar.prototype.createAdvancedShapes = function () {
  // 避免需要将所有函数绑定到"this"
  var sb = this;

  // 可重用的单元格
  var field = new mxCell('List Item', new mxGeometry(0, 0, 60, 26), 'text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;');
  field.vertex = true;

  return [
    this.createVertexTemplateEntry('shape=tapeData;whiteSpace=wrap;html=1;perimeter=ellipsePerimeter;', 80, 80, '', 'Tape Data'),
    this.createVertexTemplateEntry('shape=manualInput;whiteSpace=wrap;html=1;', 80, 80, '', 'Manual Input'),
    this.createVertexTemplateEntry('shape=loopLimit;whiteSpace=wrap;html=1;', 100, 80, '', 'Loop Limit'),
    this.createVertexTemplateEntry('shape=offPageConnector;whiteSpace=wrap;html=1;', 80, 80, '', 'Off Page Connector'),
    this.createVertexTemplateEntry('shape=delay;whiteSpace=wrap;html=1;', 80, 40, '', 'Delay'),
    this.createVertexTemplateEntry('shape=display;whiteSpace=wrap;html=1;', 80, 40, '', 'Display'),
    this.createVertexTemplateEntry('shape=singleArrow;direction=west;whiteSpace=wrap;html=1;', 100, 60, '', 'Arrow Left'),
    this.createVertexTemplateEntry('shape=singleArrow;whiteSpace=wrap;html=1;', 100, 60, '', 'Arrow Right'),
    this.createVertexTemplateEntry('shape=singleArrow;direction=north;whiteSpace=wrap;html=1;', 60, 100, '', 'Arrow Up'),
    this.createVertexTemplateEntry('shape=singleArrow;direction=south;whiteSpace=wrap;html=1;', 60, 100, '', 'Arrow Down'),
    this.createVertexTemplateEntry('shape=doubleArrow;whiteSpace=wrap;html=1;', 100, 60, '', 'Double Arrow'),
    this.createVertexTemplateEntry('shape=doubleArrow;direction=south;whiteSpace=wrap;html=1;', 60, 100, '', 'Double Arrow Vertical', null, null, 'double arrow'),
    this.createVertexTemplateEntry('shape=actor;whiteSpace=wrap;html=1;', 40, 60, '', 'User', null, null, 'user person human'),
    this.createVertexTemplateEntry('shape=cross;whiteSpace=wrap;html=1;', 80, 80, '', 'Cross'),
    this.createVertexTemplateEntry('shape=corner;whiteSpace=wrap;html=1;', 80, 80, '', 'Corner'),
    this.createVertexTemplateEntry('shape=tee;whiteSpace=wrap;html=1;', 80, 80, '', 'Tee'),
    this.createVertexTemplateEntry('shape=datastore;whiteSpace=wrap;html=1;', 60, 60, '', 'Data Store', null, null, 'data store cylinder database'),
    this.createVertexTemplateEntry('shape=orEllipse;perimeter=ellipsePerimeter;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', 'Or', null, null, 'or circle oval ellipse'),
    this.createVertexTemplateEntry('shape=sumEllipse;perimeter=ellipsePerimeter;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', 'Sum', null, null, 'sum circle oval ellipse'),
    this.createVertexTemplateEntry('shape=lineEllipse;perimeter=ellipsePerimeter;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', 'Ellipse with horizontal divider', null, null, 'circle oval ellipse'),
    this.createVertexTemplateEntry('shape=lineEllipse;line=vertical;perimeter=ellipsePerimeter;whiteSpace=wrap;html=1;backgroundOutline=1;', 80, 80, '', 'Ellipse with vertical divider', null, null, 'circle oval ellipse'),
    this.createVertexTemplateEntry('shape=sortShape;perimeter=rhombusPerimeter;whiteSpace=wrap;html=1;', 80, 80, '', 'Sort', null, null, 'sort'),
    this.createVertexTemplateEntry('shape=collate;whiteSpace=wrap;html=1;', 80, 80, '', 'Collate', null, null, 'collate'),
    this.createVertexTemplateEntry('shape=switch;whiteSpace=wrap;html=1;', 60, 60, '', 'Switch', null, null, 'switch router'),
    this.addEntry('process bar', function () {
      return sb.createVertexTemplateFromData('zZXRaoMwFIafJpcDjbNrb2233rRQ8AkyPdPQaCRJV+3T7yTG2rUVBoOtgpDzn/xJzncCIdGyateKNeVW5iBI9EqipZLS9KOqXYIQhAY8J9GKUBrgT+jbRDZ02aBhCmrzEwPtDZ9MHKBXdkpmoDWKCVN9VptO+Kw+8kqwGqMkK7nIN6yTB7uTNizbD1FSSsVPsjYMC1qFKHxwIZZSSIVxLZ1/nJNar5+oQPMT7IYCrqUta1ENzuqGaeOFTArBGs3f3Vmtoo2Se7ja1h00kSoHK4bBIKUNy3hdoPYU0mF91i9mT8EEL2ocZ3gKa00ayWujLZY4IfHKFonVDLsRGgXuQ90zBmWgneyTk3yT1iArMKrDKUeem9L3ajHrbSXwohxsQd/ggOleKM7ese048J2/fwuim1uQGmhQCW8vQMkacP3GCQgBFMftHEsr7cYYe95CnmKTPMFbYD8CQ++DGQy+/M5X4ku5wHYmdIktfvk9tecpavThqS3m/0YtnqIWPTy1cD77K2wYjo+Ay317I74A', 296, 100, 'Process Bar');
    }),
    this.createVertexTemplateEntry('swimlane;', 200, 200, 'Container', 'Container', null, null, 'container swimlane lane pool group'),
    this.addEntry('list group erd table', function () {
      var cell = new mxCell('List', new mxGeometry(0, 0, 140, 110),
        'swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;' +
        'resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;');
      cell.vertex = true;
      cell.insert(sb.cloneCell(field, 'Item 1'));
      cell.insert(sb.cloneCell(field, 'Item 2'));
      cell.insert(sb.cloneCell(field, 'Item 3'));

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'List');
    }),
    this.addEntry('list item entry value group erd table', function () {
      return sb.createVertexTemplateFromCells([sb.cloneCell(field, 'List Item')], field.geometry.width, field.geometry.height, 'List Item');
    })
  ];
};

/**
 * Adds the general palette to the sidebar.
 */
Sidebar.prototype.addBasicPalette = function (dir) {
  this.setCurrentSearchEntryLibrary('basic');
  this.addStencilPalette('basic', mxResources.get('basic'), dir + '/basic.xml',
    ';whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#000000;strokeWidth=2',
    null, null, null, null, [
      this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;bottom=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
      this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;right=0;top=0;bottom=0;fillColor=none;routingCenterX=-0.5;', 120, 60, '', 'Partial Rectangle'),
      this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;bottom=0;right=0;fillColor=none;', 120, 60, '', 'Partial Rectangle'),
      this.createVertexTemplateEntry('shape=partialRectangle;whiteSpace=wrap;html=1;top=0;left=0;fillColor=none;', 120, 60, '', 'Partial Rectangle')
    ]);
  this.setCurrentSearchEntryLibrary();
};

/**
 * Adds the general palette to the sidebar.
 */
Sidebar.prototype.addUmlPalette = function (expand) {
  // 避免需要将所有函数绑定到"this"
  var sb = this;

  // 可重用的单元格
  var field = new mxCell('+ field: type', new mxGeometry(0, 0, 100, 26), 'text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;');
  field.vertex = true;

  var divider = new mxCell('', new mxGeometry(0, 0, 40, 8), 'line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=3;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;');
  divider.vertex = true;

  // 默认标签
  var dt = 'uml static class ';
  this.setCurrentSearchEntryLibrary('uml');

  var fns = [
    this.createVertexTemplateEntry('html=1;', 110, 50, 'Object', 'Object', null, null, dt + 'object instance'),
    this.createVertexTemplateEntry('html=1;', 110, 50, '&laquo;interface&raquo;<br><b>Name</b>', 'Interface', null, null, dt + 'interface object instance annotated annotation'),
    this.addEntry(dt + 'object instance', function () {
      var cell = new mxCell('Classname', new mxGeometry(0, 0, 160, 90),
        'swimlane;fontStyle=1;align=center;verticalAlign=top;childLayout=stackLayout;horizontal=1;startSize=26;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;');
      cell.vertex = true;
      cell.insert(field.clone());
      cell.insert(divider.clone());
      cell.insert(sb.cloneCell(field, '+ method(type): type'));

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Class');
    }),
    this.addEntry(dt + 'section subsection', function () {
      var cell = new mxCell('Classname', new mxGeometry(0, 0, 140, 110),
        'swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;');
      cell.vertex = true;
      cell.insert(field.clone());
      cell.insert(field.clone());
      cell.insert(field.clone());

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Class 2');
    }),
    this.addEntry(dt + 'item member method function variable field attribute label', function () {
      return sb.createVertexTemplateFromCells([sb.cloneCell(field, '+ item: attribute')], field.geometry.width, field.geometry.height, 'Item 1');
    }),
    this.addEntry(dt + 'item member method function variable field attribute label', function () {
      var cell = new mxCell('item: attribute', new mxGeometry(0, 0, 120, field.geometry.height), 'label;fontStyle=0;strokeColor=none;fillColor=none;align=left;verticalAlign=top;overflow=hidden;' +
        'spacingLeft=28;spacingRight=4;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;imageWidth=16;imageHeight=16;image=' + sb.gearImage);
      cell.vertex = true;

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Item 2');
    }),
    this.addEntry(dt + 'divider hline line separator', function () {
      return sb.createVertexTemplateFromCells([divider.clone()], divider.geometry.width, divider.geometry.height, 'Divider');
    }),
    this.addEntry(dt + 'spacer space gap separator', function () {
      var cell = new mxCell('', new mxGeometry(0, 0, 20, 14), 'text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=4;spacingRight=4;rotatable=0;labelPosition=right;points=[];portConstraint=eastwest;');
      cell.vertex = true;

      return sb.createVertexTemplateFromCells([cell.clone()], cell.geometry.width, cell.geometry.height, 'Spacer');
    }),
    this.createVertexTemplateEntry('text;align=center;fontStyle=1;verticalAlign=middle;spacingLeft=3;spacingRight=3;strokeColor=none;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;',
      80, 26, 'Title', 'Title', null, null, dt + 'title label'),
    this.addEntry(dt + 'component', function () {
      var cell = new mxCell('&laquo;Annotation&raquo;<br/><b>Component</b>', new mxGeometry(0, 0, 180, 90), 'html=1;dropTarget=0;');
      cell.vertex = true;

      var symbol = new mxCell('', new mxGeometry(1, 0, 20, 20), 'shape=module;jettyWidth=8;jettyHeight=4;');
      symbol.vertex = true;
      symbol.geometry.relative = true;
      symbol.geometry.offset = new mxPoint(-27, 7);
      cell.insert(symbol);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Component');
    }),
    this.addEntry(dt + 'component', function () {
      var cell = new mxCell('<p style="margin:0px;margin-top:6px;text-align:center;"><b>Component</b></p>' +
        '<hr/><p style="margin:0px;margin-left:8px;">+ Attribute1: Type<br/>+ Attribute2: Type</p>', new mxGeometry(0, 0, 180, 90),
        'align=left;overflow=fill;html=1;dropTarget=0;');
      cell.vertex = true;

      var symbol = new mxCell('', new mxGeometry(1, 0, 20, 20), 'shape=component;jettyWidth=8;jettyHeight=4;');
      symbol.vertex = true;
      symbol.geometry.relative = true;
      symbol.geometry.offset = new mxPoint(-24, 4);
      cell.insert(symbol);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Component with Attributes');
    }),
    this.createVertexTemplateEntry('verticalAlign=top;align=left;spacingTop=8;spacingLeft=2;spacingRight=12;shape=cube;size=10;direction=south;fontStyle=4;html=1;',
      180, 120, 'Block', 'Block', null, null, dt + 'block'),
    this.createVertexTemplateEntry('shape=module;align=left;spacingLeft=20;align=center;verticalAlign=top;', 100, 50, 'Module', 'Module', null, null, dt + 'module component'),
    this.createVertexTemplateEntry('shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;', 70, 50,
      'package', 'Package', null, null, dt + 'package'),
    this.createVertexTemplateEntry('verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;',
      160, 90, '<p style="margin:0px;margin-top:4px;text-align:center;text-decoration:underline;"><b>Object:Type</b></p><hr/>' +
      '<p style="margin:0px;margin-left:8px;">field1 = value1<br/>field2 = value2<br>field3 = value3</p>', 'Object',
      null, null, dt + 'object instance'),
    this.createVertexTemplateEntry('verticalAlign=top;align=left;overflow=fill;html=1;', 180, 90,
      '<div style="box-sizing:border-box;width:100%;background:#e4e4e4;padding:2px;">Tablename</div>' +
      '<table style="width:100%;font-size:1em;" cellpadding="2" cellspacing="0">' +
      '<tr><td>PK</td><td>uniqueId</td></tr><tr><td>FK1</td><td>' +
      'foreignKey</td></tr><tr><td></td><td>fieldname</td></tr></table>', 'Entity', null, null, 'er entity table'),
    this.addEntry(dt + 'object instance', function () {
      var cell = new mxCell('<p style="margin:0px;margin-top:4px;text-align:center;">' +
        '<b>Class</b></p>' +
        '<hr size="1"/><div style="height:2px;"></div>', new mxGeometry(0, 0, 140, 60),
        'verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;');
      cell.vertex = true;

      return sb.createVertexTemplateFromCells([cell.clone()], cell.geometry.width, cell.geometry.height, 'Class 3');
    }),
    this.addEntry(dt + 'object instance', function () {
      var cell = new mxCell('<p style="margin:0px;margin-top:4px;text-align:center;">' +
        '<b>Class</b></p>' +
        '<hr size="1"/><div style="height:2px;"></div><hr size="1"/><div style="height:2px;"></div>', new mxGeometry(0, 0, 140, 60),
        'verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;');
      cell.vertex = true;

      return sb.createVertexTemplateFromCells([cell.clone()], cell.geometry.width, cell.geometry.height, 'Class 4');
    }),
    this.addEntry(dt + 'object instance', function () {
      var cell = new mxCell('<p style="margin:0px;margin-top:4px;text-align:center;">' +
        '<b>Class</b></p>' +
        '<hr size="1"/><p style="margin:0px;margin-left:4px;">+ field: Type</p><hr size="1"/>' +
        '<p style="margin:0px;margin-left:4px;">+ method(): Type</p>', new mxGeometry(0, 0, 160, 90),
        'verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;');
      cell.vertex = true;

      return sb.createVertexTemplateFromCells([cell.clone()], cell.geometry.width, cell.geometry.height, 'Class 5');
    }),
    this.addEntry(dt + 'object instance', function () {
      var cell = new mxCell('<p style="margin:0px;margin-top:4px;text-align:center;">' +
        '<i>&lt;&lt;Interface&gt;&gt;</i><br/><b>Interface</b></p>' +
        '<hr size="1"/><p style="margin:0px;margin-left:4px;">+ field1: Type<br/>' +
        '+ field2: Type</p>' +
        '<hr size="1"/><p style="margin:0px;margin-left:4px;">' +
        '+ method1(Type): Type<br/>' +
        '+ method2(Type, Type): Type</p>', new mxGeometry(0, 0, 190, 140),
        'verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;');
      cell.vertex = true;

      return sb.createVertexTemplateFromCells([cell.clone()], cell.geometry.width, cell.geometry.height, 'Interface 2');
    }),
    this.createVertexTemplateEntry('shape=providedRequiredInterface;html=1;verticalLabelPosition=bottom;', 20, 20, '', 'Provided/Required Interface', null, null, 'uml provided required interface lollipop notation'),
    this.createVertexTemplateEntry('shape=requiredInterface;html=1;verticalLabelPosition=bottom;', 10, 20, '', 'Required Interface', null, null, 'uml required interface lollipop notation'),
    this.addEntry('uml lollipop notation provided required interface', function () {
      return sb.createVertexTemplateFromData('zVTBrptADPyavVYEkt4b0uQd3pMq5dD2uAUD27dgZJwE8vX1spsQlETtpVWRIjFjex3PmFVJWvc70m31hjlYlXxWSUqI7N/qPgVrVRyZXCUbFceR/FS8fRJdjNGo1QQN/0lB7AuO2h7AM57oeLCBIDw0Obj8SCVrJK6wxEbbV8RWyIWQP4F52Juzq9AHRqEqrm2IQpN/IsKTwAYb8MzWWBuO9B0hL2E2BGsqIQyxvJ9rzApD7QBrYBokhcBqNsf5UbrzsLzmXUu/oJET42jwGat5QYcHyiDkTDLKy03TiRrFfSx08m+FrrQtUkOZvZdbFKThmwMfVhf4fQ43/W3uZriiPPT+KKhjwnf4anKuQv//wsg+NPJ7/9d9Xf7eVykwbeeMOFWGYd/qzEVO8tHP/Suw4a2ujXV/+gXsEdhkOgSC8os44BQt0tggicZHeG1N2QiXibhAV48epRayEDd8MT7Ct06TUaXVWq027tCuhcx5VZjebeeaoDNn/WMcb/p+j0AM/dNr6InLl4Lgzylsk6OCgRWYsuI592gNZh5OhgmcblPv7+1l+ws=',
        40, 10, 'Lollipop Notation');
    }),
    this.createVertexTemplateEntry('shape=umlBoundary;whiteSpace=wrap;html=1;', 100, 80, 'Boundary Object', 'Boundary Object', null, null, 'uml boundary object'),
    this.createVertexTemplateEntry('ellipse;shape=umlEntity;whiteSpace=wrap;html=1;', 80, 80, 'Entity Object', 'Entity Object', null, null, 'uml entity object'),
    this.createVertexTemplateEntry('ellipse;shape=umlControl;whiteSpace=wrap;html=1;', 70, 80, 'Control Object', 'Control Object', null, null, 'uml control object'),
    this.createVertexTemplateEntry('shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;', 30, 60, 'Actor', 'Actor', false, null, 'uml actor'),
    this.createVertexTemplateEntry('ellipse;whiteSpace=wrap;html=1;', 140, 70, 'Use Case', 'Use Case', null, null, 'uml use case usecase'),
    this.addEntry('uml activity state start', function () {
      var cell = new mxCell('', new mxGeometry(0, 0, 30, 30),
        'ellipse;html=1;shape=startState;fillColor=#000000;strokeColor=#ff0000;');
      cell.vertex = true;

      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'edgeStyle=orthogonalEdgeStyle;html=1;verticalAlign=bottom;endArrow=open;endSize=8;strokeColor=#ff0000;');
      edge.geometry.setTerminalPoint(new mxPoint(15, 90), false);
      edge.geometry.relative = true;
      edge.edge = true;

      cell.insertEdge(edge, true);

      return sb.createVertexTemplateFromCells([cell, edge], 30, 90, 'Start');
    }),
    this.addEntry('uml activity state', function () {
      var cell = new mxCell('Activity', new mxGeometry(0, 0, 120, 40),
        'rounded=1;whiteSpace=wrap;html=1;arcSize=40;fontColor=#000000;fillColor=#ffffc0;strokeColor=#ff0000;');
      cell.vertex = true;

      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'edgeStyle=orthogonalEdgeStyle;html=1;verticalAlign=bottom;endArrow=open;endSize=8;strokeColor=#ff0000;');
      edge.geometry.setTerminalPoint(new mxPoint(60, 100), false);
      edge.geometry.relative = true;
      edge.edge = true;

      cell.insertEdge(edge, true);

      return sb.createVertexTemplateFromCells([cell, edge], 120, 100, 'Activity');
    }),
    this.addEntry('uml activity composite state', function () {
      var cell = new mxCell('Composite State', new mxGeometry(0, 0, 160, 60),
        'swimlane;html=1;fontStyle=1;align=center;verticalAlign=middle;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=0;resizeLast=1;container=0;fontColor=#000000;collapsible=0;rounded=1;arcSize=30;strokeColor=#ff0000;fillColor=#ffffc0;swimlaneFillColor=#ffffc0;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('Subtitle', new mxGeometry(0, 0, 200, 26), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;spacingLeft=4;spacingRight=4;whiteSpace=wrap;overflow=hidden;rotatable=0;fontColor=#000000;');
      cell1.vertex = true;
      cell.insert(cell1);

      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'edgeStyle=orthogonalEdgeStyle;html=1;verticalAlign=bottom;endArrow=open;endSize=8;strokeColor=#ff0000;');
      edge.geometry.setTerminalPoint(new mxPoint(80, 120), false);
      edge.geometry.relative = true;
      edge.edge = true;

      cell.insertEdge(edge, true);

      return sb.createVertexTemplateFromCells([cell, edge], 160, 120, 'Composite State');
    }),
    this.addEntry('uml activity condition', function () {
      var cell = new mxCell('Condition', new mxGeometry(0, 0, 80, 40), 'rhombus;whiteSpace=wrap;html=1;fillColor=#ffffc0;strokeColor=#ff0000;');
      cell.vertex = true;

      var edge1 = new mxCell('no', new mxGeometry(0, 0, 0, 0), 'edgeStyle=orthogonalEdgeStyle;html=1;align=left;verticalAlign=bottom;endArrow=open;endSize=8;strokeColor=#ff0000;');
      edge1.geometry.setTerminalPoint(new mxPoint(180, 20), false);
      edge1.geometry.relative = true;
      edge1.geometry.x = -1;
      edge1.edge = true;

      cell.insertEdge(edge1, true);

      var edge2 = new mxCell('yes', new mxGeometry(0, 0, 0, 0), 'edgeStyle=orthogonalEdgeStyle;html=1;align=left;verticalAlign=top;endArrow=open;endSize=8;strokeColor=#ff0000;');
      edge2.geometry.setTerminalPoint(new mxPoint(40, 100), false);
      edge2.geometry.relative = true;
      edge2.geometry.x = -1;
      edge2.edge = true;

      cell.insertEdge(edge2, true);

      return sb.createVertexTemplateFromCells([cell, edge1, edge2], 180, 100, 'Condition');
    }),
    this.addEntry('uml activity fork join', function () {
      var cell = new mxCell('', new mxGeometry(0, 0, 200, 10), 'shape=line;html=1;strokeWidth=6;strokeColor=#ff0000;');
      cell.vertex = true;

      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'edgeStyle=orthogonalEdgeStyle;html=1;verticalAlign=bottom;endArrow=open;endSize=8;strokeColor=#ff0000;');
      edge.geometry.setTerminalPoint(new mxPoint(100, 80), false);
      edge.geometry.relative = true;
      edge.edge = true;

      cell.insertEdge(edge, true);

      return sb.createVertexTemplateFromCells([cell, edge], 200, 80, 'Fork/Join');
    }),
    this.createVertexTemplateEntry('ellipse;html=1;shape=endState;fillColor=#000000;strokeColor=#ff0000;', 30, 30, '', 'End', null, null, 'uml activity state end'),
    this.createVertexTemplateEntry('shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;', 100, 15000, ':Object', 'Lifeline', null, null, 'uml sequence participant lifeline'),
    this.createVertexTemplateEntry('shape=umlLifeline;participant=umlActor;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;verticalAlign=top;spacingTop=36;outlineConnect=0;',
      20, 15000, '', 'Actor Lifeline', null, null, 'uml sequence participant lifeline actor'),
    this.createVertexTemplateEntry('shape=umlLifeline;participant=umlBoundary;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;verticalAlign=top;spacingTop=36;outlineConnect=0;',
      50, 15000, '', 'Boundary Lifeline', null, null, 'uml sequence participant lifeline boundary'),
    this.createVertexTemplateEntry('shape=umlLifeline;participant=umlEntity;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;verticalAlign=top;spacingTop=36;outlineConnect=0;',
      40, 15000, '', 'Entity Lifeline', null, null, 'uml sequence participant lifeline entity'),
    this.createVertexTemplateEntry('shape=umlLifeline;participant=umlControl;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;verticalAlign=top;spacingTop=36;outlineConnect=0;',
      40, 15000, '', 'Control Lifeline', null, null, 'uml sequence participant lifeline control'),
    this.createVertexTemplateEntry('shape=umlFrame;whiteSpace=wrap;html=1;', 300, 200, 'frame', 'Frame', null, null, 'uml sequence frame'),
    this.createVertexTemplateEntry('shape=umlDestroy;whiteSpace=wrap;html=1;strokeWidth=3;', 30, 30, '', 'Destruction', null, null, 'uml sequence destruction destroy'),
    this.addEntry('uml sequence invoke invocation call activation', function () {
      var cell = new mxCell('', new mxGeometry(0, 0, 10, 80), 'html=1;points=[];perimeter=orthogonalPerimeter;');
      cell.vertex = true;

      var edge = new mxCell('dispatch', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;startArrow=oval;endArrow=block;startSize=8;');
      edge.geometry.setTerminalPoint(new mxPoint(-60, 0), true);
      edge.geometry.relative = true;
      edge.edge = true;

      cell.insertEdge(edge, false);

      return sb.createVertexTemplateFromCells([cell, edge], 10, 80, 'Found Message');
    }),
    this.addEntry('uml sequence invoke call delegation synchronous invocation activation', function () {
      var cell = new mxCell('', new mxGeometry(0, 0, 10, 80), 'html=1;points=[];perimeter=orthogonalPerimeter;');
      cell.vertex = true;

      var edge1 = new mxCell('dispatch', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;endArrow=block;entryX=0;entryY=0;');
      edge1.geometry.setTerminalPoint(new mxPoint(-70, 0), true);
      edge1.geometry.relative = true;
      edge1.edge = true;

      cell.insertEdge(edge1, false);

      var edge2 = new mxCell('return', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;exitX=0;exitY=0.95;');
      edge2.geometry.setTerminalPoint(new mxPoint(-70, 76), false);
      edge2.geometry.relative = true;
      edge2.edge = true;

      cell.insertEdge(edge2, true);

      return sb.createVertexTemplateFromCells([cell, edge1, edge2], 10, 80, 'Synchronous Invocation');
    }),
    this.addEntry('uml sequence self call recursion delegation activation', function () {
      var cell = new mxCell('', new mxGeometry(-5, 20, 10, 40), 'html=1;points=[];perimeter=orthogonalPerimeter;');
      cell.vertex = true;

      var edge = new mxCell('self call', new mxGeometry(0, 0, 0, 0), 'edgeStyle=orthogonalEdgeStyle;html=1;align=left;spacingLeft=2;endArrow=block;rounded=0;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.points = [new mxPoint(30, 0)];
      edge.geometry.relative = true;
      edge.edge = true;

      cell.insertEdge(edge, false);

      return sb.createVertexTemplateFromCells([cell, edge], 10, 60, 'Self Call');
    }),
    this.addEntry('uml sequence invoke call delegation callback activation', function () {
      // TODO: 检查是否应该将更多条目转换为压缩的XML
      return sb.createVertexTemplateFromData('xZRNT8MwDIZ/Ta6oaymD47rBTkiTuMAxW6wmIm0q19s6fj1OE3V0Y2iCA4dK8euP2I+riGxedUuUjX52CqzIHkU2R+conKpuDtaKNDFKZAuRpgl/In264J303qSRCDVdk5CGhJ20WwhKEFo62ChoqritxURkReNMTa2X80LkC68AmgoIkEWHpF3pamlXR7WIFwASdBeb7KXY4RIc5+KBQ/ZGkY4RYY5Egyl1zLqLmmyDXQ6Zx4n5EIf+HkB2BmAjrV3LzftPIPw4hgNn1pQ1a2tH5Cp2QK1miG7vNeu4iJe4pdeY2BtvbCQDGlAljMCQxBJotJ8rWCFYSWY3LvUdmZi68rvkkLiU6QnL1m1xAzHoBOdw61WEb88II9AW67/ydQ2wq1Cy1aAGvOrFfPh6997qDA3g+dxzv3nIL6MPU/8T+kMw8+m4QPgdfrEJNo8PSQj/+s58Ag==',
        10, 60, 'Callback');
    }),
    this.createVertexTemplateEntry('html=1;points=[];perimeter=orthogonalPerimeter;', 10, 80, '', 'Activation', null, null, 'uml sequence activation'),

    this.createEdgeTemplateEntry('html=1;verticalAlign=bottom;startArrow=oval;startFill=1;endArrow=block;startSize=8;', 60, 0, 'dispatch', 'Found Message 1', null, 'uml sequence message call invoke dispatch'),
    this.createEdgeTemplateEntry('html=1;verticalAlign=bottom;startArrow=circle;startFill=1;endArrow=open;startSize=6;endSize=8;', 80, 0, 'dispatch', 'Found Message 2', null, 'uml sequence message call invoke dispatch'),
    this.createEdgeTemplateEntry('html=1;verticalAlign=bottom;endArrow=block;', 80, 0, 'dispatch', 'Message', null, 'uml sequence message call invoke dispatch'),
    this.addEntry('uml sequence return message', function () {
      var edge = new mxCell('return', new mxGeometry(0, 0, 0, 0), 'html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;');
      edge.geometry.setTerminalPoint(new mxPoint(80, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), false);
      edge.geometry.relative = true;
      edge.edge = true;

      return sb.createEdgeTemplateFromCells([edge], 80, 0, 'Return');
    }),
    this.addEntry('uml relation', function () {
      var edge = new mxCell('name', new mxGeometry(0, 0, 0, 0), 'endArrow=block;endFill=1;html=1;edgeStyle=orthogonalEdgeStyle;align=left;verticalAlign=top;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(160, 0), false);
      edge.geometry.relative = true;
      edge.geometry.x = -1;
      edge.edge = true;

      var cell = new mxCell('1', new mxGeometry(-1, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=left;verticalAlign=bottom;');
      cell.geometry.relative = true;
      cell.setConnectable(false);
      cell.vertex = true;
      edge.insert(cell);

      return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Relation 1');
    }),
    this.addEntry('uml association', function () {
      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'endArrow=none;html=1;edgeStyle=orthogonalEdgeStyle;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(160, 0), false);
      edge.geometry.relative = true;
      edge.edge = true;

      var cell1 = new mxCell('parent', new mxGeometry(-1, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=left;verticalAlign=bottom;');
      cell1.geometry.relative = true;
      cell1.setConnectable(false);
      cell1.vertex = true;
      edge.insert(cell1);

      var cell2 = new mxCell('child', new mxGeometry(1, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=right;verticalAlign=bottom;');
      cell2.geometry.relative = true;
      cell2.setConnectable(false);
      cell2.vertex = true;
      edge.insert(cell2);

      return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Association 1');
    }),
    this.addEntry('uml aggregation', function () {
      var edge = new mxCell('1', new mxGeometry(0, 0, 0, 0), 'endArrow=open;html=1;endSize=12;startArrow=diamondThin;startSize=18;startFill=0;edgeStyle=orthogonalEdgeStyle;align=left;verticalAlign=bottom;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(160, 0), false);
      edge.geometry.relative = true;
      edge.geometry.x = -1;
      edge.geometry.y = 3;
      edge.edge = true;

      return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Aggregation 1');
    }),
    this.addEntry('uml composition', function () {
      var edge = new mxCell('1', new mxGeometry(0, 0, 0, 0), 'endArrow=open;html=1;endSize=12;startArrow=diamondThin;startSize=18;startFill=1;edgeStyle=orthogonalEdgeStyle;align=left;verticalAlign=bottom;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(160, 0), false);
      edge.geometry.relative = true;
      edge.geometry.x = -1;
      edge.geometry.y = 3;
      edge.edge = true;

      return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Composition 1');
    }),
    this.addEntry('uml relation', function () {
      var edge = new mxCell('Relation', new mxGeometry(0, 0, 0, 0), 'endArrow=open;html=1;endSize=12;startArrow=diamondThin;startSize=18;startFill=0;edgeStyle=orthogonalEdgeStyle;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(160, 0), false);
      edge.geometry.relative = true;
      edge.edge = true;

      var cell1 = new mxCell('0..n', new mxGeometry(-1, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=left;verticalAlign=top;');
      cell1.geometry.relative = true;
      cell1.setConnectable(false);
      cell1.vertex = true;
      edge.insert(cell1);

      var cell2 = new mxCell('1', new mxGeometry(1, 0, 0, 0), 'edgeLabel;resizable=0;html=1;align=right;verticalAlign=top;');
      cell2.geometry.relative = true;
      cell2.setConnectable(false);
      cell2.vertex = true;
      edge.insert(cell2);

      return sb.createEdgeTemplateFromCells([edge], 160, 0, 'Relation 2');
    }),
    this.createEdgeTemplateEntry('endArrow=open;endSize=12;dashed=1;html=1;', 160, 0, 'Use', 'Dependency', null, 'uml dependency use'),
    this.createEdgeTemplateEntry('endArrow=block;endSize=16;endFill=0;html=1;', 160, 0, 'Extends', 'Generalization', null, 'uml generalization extend'),
    this.createEdgeTemplateEntry('endArrow=block;startArrow=block;endFill=1;startFill=1;html=1;', 160, 0, '', 'Association 2', null, 'uml association'),
    this.createEdgeTemplateEntry('endArrow=open;startArrow=circlePlus;endFill=0;startFill=0;endSize=8;html=1;', 160, 0, '', 'Inner Class', null, 'uml inner class'),
    this.createEdgeTemplateEntry('endArrow=open;startArrow=cross;endFill=0;startFill=0;endSize=8;startSize=10;html=1;', 160, 0, '', 'Terminate', null, 'uml terminate'),
    this.createEdgeTemplateEntry('endArrow=block;dashed=1;endFill=0;endSize=12;html=1;', 160, 0, '', 'Implementation', null, 'uml realization implementation'),
    this.createEdgeTemplateEntry('endArrow=diamondThin;endFill=0;endSize=24;html=1;', 160, 0, '', 'Aggregation 2', null, 'uml aggregation'),
    this.createEdgeTemplateEntry('endArrow=diamondThin;endFill=1;endSize=24;html=1;', 160, 0, '', 'Composition 2', null, 'uml composition'),
    this.createEdgeTemplateEntry('endArrow=open;endFill=1;endSize=12;html=1;', 160, 0, '', 'Association 3', null, 'uml association')
  ];

  this.addPaletteFunctions('uml', mxResources.get('uml'), expand || false, fns);
  this.setCurrentSearchEntryLibrary();
};

/**
 * Adds the BPMN library to the sidebar.
 */
Sidebar.prototype.addBpmnPalette = function (dir, expand) {
  // 避免需要将所有函数绑定到"this"
  var sb = this;
  this.setCurrentSearchEntryLibrary('bpmn');

  var fns = [
    this.createVertexTemplateEntry('shape=ext;rounded=1;html=1;whiteSpace=wrap;', 120, 80, 'Task', 'Process', null, null, 'bpmn task process'),
    this.createVertexTemplateEntry('shape=ext;rounded=1;html=1;whiteSpace=wrap;double=1;', 120, 80, 'Transaction', 'Transaction', null, null, 'bpmn transaction'),
    this.createVertexTemplateEntry('shape=ext;rounded=1;html=1;whiteSpace=wrap;dashed=1;dashPattern=1 4;', 120, 80, 'Event\nSub-Process', 'Event Sub-Process', null, null, 'bpmn event subprocess sub process sub-process'),
    this.createVertexTemplateEntry('shape=ext;rounded=1;html=1;whiteSpace=wrap;strokeWidth=3;', 120, 80, 'Call Activity', 'Call Activity', null, null, 'bpmn call activity'),
    this.addEntry('bpmn subprocess sub process sub-process', function () {
      var cell = new mxCell('Sub-Process', new mxGeometry(0, 0, 120, 80), 'html=1;whiteSpace=wrap;rounded=1;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;outlineConnect=0;');
      cell1.vertex = true;
      cell1.geometry.relative = true;
      cell1.geometry.offset = new mxPoint(-7, -14);
      cell.insert(cell1);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Sub-Process');
    }),
    this.addEntry(this.getTagsForStencil('mxgraph.bpmn', 'loop', 'subprocess sub process sub-process looped').join(' '), function () {
      var cell = new mxCell('Looped\nSub-Process', new mxGeometry(0, 0, 120, 80), 'html=1;whiteSpace=wrap;rounded=1;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=mxgraph.bpmn.loop;outlineConnect=0;');
      cell1.vertex = true;
      cell1.geometry.relative = true;
      cell1.geometry.offset = new mxPoint(-15, -14);
      cell.insert(cell1);

      var cell2 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;');
      cell2.vertex = true;
      cell2.geometry.relative = true;
      cell2.geometry.offset = new mxPoint(1, -14);
      cell.insert(cell2);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Looped Sub-Process');
    }),
    this.addEntry('bpmn receive task', function () {
      var cell = new mxCell('Receive', new mxGeometry(0, 0, 120, 80), 'html=1;whiteSpace=wrap;rounded=1;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('', new mxGeometry(0, 0, 20, 14), 'html=1;shape=message;outlineConnect=0;');
      cell1.vertex = true;
      cell1.geometry.relative = true;
      cell1.geometry.offset = new mxPoint(7, 7);
      cell.insert(cell1);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Receive Task');
    }),
    this.addEntry(this.getTagsForStencil('mxgraph.bpmn', 'user_task').join(' '), function () {
      var cell = new mxCell('User', new mxGeometry(0, 0, 120, 80), 'html=1;whiteSpace=wrap;rounded=1;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('', new mxGeometry(0, 0, 14, 14), 'html=1;shape=mxgraph.bpmn.user_task;outlineConnect=0;');
      cell1.vertex = true;
      cell1.geometry.relative = true;
      cell1.geometry.offset = new mxPoint(7, 7);
      cell.insert(cell1);

      var cell2 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;outlineConnect=0;');
      cell2.vertex = true;
      cell2.geometry.relative = true;
      cell2.geometry.offset = new mxPoint(-7, -14);
      cell.insert(cell2);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'User Task');
    }),
    this.addEntry(this.getTagsForStencil('mxgraph.bpmn', 'timer_start', 'attached').join(' '), function () {
      var cell = new mxCell('Process', new mxGeometry(0, 0, 120, 80), 'html=1;whiteSpace=wrap;rounded=1;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('', new mxGeometry(1, 1, 30, 30), 'shape=mxgraph.bpmn.timer_start;perimeter=ellipsePerimeter;html=1;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;');
      cell1.vertex = true;
      cell1.geometry.relative = true;
      cell1.geometry.offset = new mxPoint(-40, -15);
      cell.insert(cell1);

      return sb.createVertexTemplateFromCells([cell], 120, 95, 'Attached Timer Event 1');
    }),
    this.addEntry(this.getTagsForStencil('mxgraph.bpmn', 'timer_start', 'attached').join(' '), function () {
      var cell = new mxCell('Process', new mxGeometry(0, 0, 120, 80), 'html=1;whiteSpace=wrap;rounded=1;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('', new mxGeometry(1, 0, 30, 30), 'shape=mxgraph.bpmn.timer_start;perimeter=ellipsePerimeter;html=1;labelPosition=right;align=left;outlineConnect=0;');
      cell1.vertex = true;
      cell1.geometry.relative = true;
      cell1.geometry.offset = new mxPoint(-15, 10);
      cell.insert(cell1);

      return sb.createVertexTemplateFromCells([cell], 135, 80, 'Attached Timer Event 2');
    }),
    this.createVertexTemplateEntry('swimlane;html=1;horizontal=0;startSize=20;', 320, 240, 'Pool', 'Pool', null, null, 'bpmn pool'),
    this.createVertexTemplateEntry('swimlane;html=1;horizontal=0;swimlaneLine=0;', 300, 120, 'Lane', 'Lane', null, null, 'bpmn lane'),
    this.createVertexTemplateEntry('shape=hexagon;html=1;whiteSpace=wrap;perimeter=hexagonPerimeter;rounded=0;', 60, 50, '', 'Conversation', null, null, 'bpmn conversation'),
    this.createVertexTemplateEntry('shape=hexagon;html=1;whiteSpace=wrap;perimeter=hexagonPerimeter;strokeWidth=4;rounded=0;', 60, 50, '', 'Call Conversation', null, null, 'bpmn call conversation'),
    this.addEntry('bpmn subconversation sub conversation sub-conversation', function () {
      var cell = new mxCell('', new mxGeometry(0, 0, 60, 50), 'shape=hexagon;whiteSpace=wrap;html=1;perimeter=hexagonPerimeter;rounded=0;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;shape=plus;');
      cell1.vertex = true;
      cell1.geometry.relative = true;
      cell1.geometry.offset = new mxPoint(-7, -14);
      cell.insert(cell1);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Sub-Conversation');
    }),
    this.addEntry('bpmn data object', function () {
      var cell = new mxCell('', new mxGeometry(0, 0, 40, 60), 'shape=note;whiteSpace=wrap;size=16;html=1;dropTarget=0;');
      cell.vertex = true;

      var cell1 = new mxCell('', new mxGeometry(0, 0, 14, 14), 'html=1;shape=singleArrow;arrowWidth=0.4;arrowSize=0.4;outlineConnect=0;');
      cell1.vertex = true;
      cell1.geometry.relative = true;
      cell1.geometry.offset = new mxPoint(2, 2);
      cell.insert(cell1);

      var cell2 = new mxCell('', new mxGeometry(0.5, 1, 14, 14), 'html=1;whiteSpace=wrap;shape=parallelMarker;outlineConnect=0;');
      cell2.vertex = true;
      cell2.geometry.relative = true;
      cell2.geometry.offset = new mxPoint(-7, -14);
      cell.insert(cell2);

      return sb.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'Data Object');
    }),
    this.createVertexTemplateEntry('shape=datastore;whiteSpace=wrap;html=1;', 60, 60, '', 'Data Store', null, null, 'bpmn data store'),
    this.createVertexTemplateEntry('shape=plus;html=1;outlineConnect=0;', 14, 14, '', 'Sub-Process Marker', null, null, 'bpmn subprocess sub process sub-process marker'),
    this.createVertexTemplateEntry('shape=mxgraph.bpmn.loop;html=1;outlineConnect=0;', 14, 14, '', 'Loop Marker', null, null, 'bpmn loop marker'),
    this.createVertexTemplateEntry('shape=parallelMarker;html=1;outlineConnect=0;', 14, 14, '', 'Parallel MI Marker', null, null, 'bpmn parallel mi marker'),
    this.createVertexTemplateEntry('shape=parallelMarker;direction=south;html=1;outlineConnect=0;', 14, 14, '', 'Sequential MI Marker', null, null, 'bpmn sequential mi marker'),
    this.createVertexTemplateEntry('shape=mxgraph.bpmn.ad_hoc;fillColor=#000000;html=1;outlineConnect=0;', 14, 14, '', 'Ad Hoc Marker', null, null, 'bpmn ad hoc marker'),
    this.createVertexTemplateEntry('shape=mxgraph.bpmn.compensation;html=1;outlineConnect=0;', 14, 14, '', 'Compensation Marker', null, null, 'bpmn compensation marker'),
    this.createVertexTemplateEntry('shape=message;whiteSpace=wrap;html=1;outlineConnect=0;fillColor=#000000;strokeColor=#ffffff;strokeWidth=2;', 40, 30, '', 'Send Task', null, null, 'bpmn send task'),
    this.createVertexTemplateEntry('shape=message;whiteSpace=wrap;html=1;outlineConnect=0;', 40, 30, '', 'Receive Task', null, null, 'bpmn receive task'),
    this.createVertexTemplateEntry('shape=mxgraph.bpmn.user_task;html=1;outlineConnect=0;', 14, 14, '', 'User Task', null, null, this.getTagsForStencil('mxgraph.bpmn', 'user_task').join(' ')),
    this.createVertexTemplateEntry('shape=mxgraph.bpmn.manual_task;html=1;outlineConnect=0;', 14, 14, '', 'Manual Task', null, null, this.getTagsForStencil('mxgraph.bpmn', 'user_task').join(' ')),
    this.createVertexTemplateEntry('shape=mxgraph.bpmn.business_rule_task;html=1;outlineConnect=0;', 14, 14, '', 'Business Rule Task', null, null, this.getTagsForStencil('mxgraph.bpmn', 'business_rule_task').join(' ')),
    this.createVertexTemplateEntry('shape=mxgraph.bpmn.service_task;html=1;outlineConnect=0;', 14, 14, '', 'Service Task', null, null, this.getTagsForStencil('mxgraph.bpmn', 'service_task').join(' ')),
    this.createVertexTemplateEntry('shape=mxgraph.bpmn.script_task;html=1;outlineConnect=0;', 14, 14, '', 'Script Task', null, null, this.getTagsForStencil('mxgraph.bpmn', 'script_task').join(' ')),
    this.createVertexTemplateEntry('html=1;shape=mxgraph.flowchart.annotation_2;align=left;labelPosition=right;', 50, 100, '', 'Annotation', null, null, this.getTagsForStencil('bpmn', 'annotation_1', 'bpmn business process model ').join(' ')),
    this.addDataEntry('crossfunctional cross-functional cross functional flowchart swimlane table', 400, 400, 'Cross-Functional Flowchart', '7ZhRb5swEMc/DY+bMCRt97jQpi+tVC2fwINbbMnYyD4C6aefjaHpBrTRlNCoTALJPp9t+P25O5kgTvL6XtOCPaoMRBDfBXGilULfyusEhAiikGdBfBtEUWjvIFqPjJJmNCyoBonHTIj8hB0VJXiL3dyYL+tSpsiVpM55LVSVMqrROxvci9bZMFq4JtKfzrRKGRfZA92rEjtr11tpVT1wCcYOhM5ViTKXry0G7RYb/uwWXDgDw9wCuSW2WTGOsClo6gYri8uvIGhheLN1s4KGtNSG7+AHGL+Os0JdUJm1nUJxiaDvdhZQt/EvJXHTvpTbjAq+lbadgnO1hhYSaIR6FHRjainfg8oB9d66VDxD5j0WoRcjZMC3DP8yUuMN25e5B91so5VuWMa4J+P3FJW2JtLXrOK5oNLJxZTmz/blqXhNp3mO5cpe9smS8OsyWNp5ie2TQ99ezl1joqRBTXmDAajBCgxejprHKBcNK7fvBPIz3hOSRCcQctET8olRA+8JmSopIW2j8GOD6Sji8TDxepT4C9yTE1+OEo/mQ5xcTYn8ahR5PB/k0c2UyK9HC8SbX/mnLBAnqAlD8XK+onDTE+/fw+TiQF9fTin4Nl/O0xYAEs6X9LR5n5Ae6S7xv1lr/yf+4cQ/pN75Ej/pH88/UZyQkRPzR6R+0j9Bz4f0xMm/f8adD+qzZn/bPfw5bMb++LH4Gw=='),
    this.addDataEntry('container swimlane pool horizontal', 480, 380, 'Horizontal Pool 1',
      'zZRLbsIwEIZP4709TlHXhJYNSEicwCIjbNWJkWNKwumZxA6IlrRUaisWlmb+eX8LM5mXzdyrnV66Ai2TL0zm3rkQrbLJ0VoG3BRMzhgAp8fgdSQq+ijfKY9VuKcAYsG7snuMyso5G8U6tDaJ9cGUVlXkTXUoacuZIHOjjS0WqnX7blYd1OZt8KYea3PE1bCI+CAtVUMq7/o5b46uCmroSn18WFMm+XCdse5GpLq0OPqAzejxvZQun6MrMfiWUg6mCDpmZM8RENdotjqVyUFUdRS259oLSzISztto5Se0i44gcHEn3i9A/IQB3GbQpmi69DskAn4BSTaGBB4Jicj+k8nTGBP5SExg8odMyL38eH3s6kM8AQ=='),
    this.addDataEntry('container swimlane pool horizontal', 480, 360, 'Horizontal Pool 2',
      'zZTBbsIwDIafJvfU6dDOlI0LSEg8QUQtEi1tUBJGy9PPbcJQWTsxaZs4VLJ//07sT1WYKKpm6eRBrW2JhokXJgpnbYhR1RRoDAOuSyYWDIDTx+B1opr1VX6QDutwTwPEhndpjhiVjbUmij60Jon+pCsja8rmKlQ05SKjcKe0KVeytcfuLh/k7u2SzR16fcbNZZDsRlrLhlTenWedPts6SJMEOseFLTkph6Fj212RbGlwdAGbyeV7KW2+RFthcC1ZTroMKjry5wiIK9R7ldrELInSR2H/2XtlSUHCOY5WfEG76ggCz+7E+w2InzCAcQapIf0fAySzESQZ/AKSfAoJPCKS9mbzf0H0NIVIPDAiyP8QEaXX97CvDZ7LDw=='),
    this.createVertexTemplateEntry('swimlane;startSize=20;horizontal=0;', 320, 120, 'Lane', 'Horizontal Swimlane', null, null, 'swimlane lane pool'),
    this.addDataEntry('container swimlane pool horizontal', 360, 480, 'Vertical Pool 1',
      'xZRBbsIwEEVP4709ThFrQssGJKSewCIjbNXGyDEl4fSdxKa0NJFQVTULSzP/e+T5b2EmS9esgjrqja/QMvnMZBm8j6lyTYnWMuCmYnLJADgdBi8jruhdflQBD/GRAUgD78qeMClb720S69jaLNZn46w6ULfQ0dGWS0HlThtbrVXrT91bdVS7t2u3CFibC26vi4g7aaMaUjmpNBbiKxnUQyfkjTBEbEZT9VKOtELvMIaWrpxNFXW6IWcpOddo9jqPFfMsqjoJ+8/ZGyQqMqdhZvIHs3WHBrh4kNvvIsNw5Da7OdgXAgKGCMz+gEAxRgCmINDcxZ2CyNMYETkhESj+jwi1t1+r9759ah8='),
    this.addDataEntry('container swimlane pool vertical', 380, 480, 'Vertical Pool 2',
      'xZTPbsIwDMafJvf86dDOlI0LSEg8QUQtEi1pUBJGy9PPbdJ1G1TqhXGoZH/219g/RSGitM3ay5PaugoMEW9ElN65mCLblGAM4VRXRKwI5xQ/wt8nqqyv0pP0UMc5Bp4Mn9KcISk750wSQ2xNFsNFWyNrzJYqWpxyxTA8KG2qjWzduTsrRHn4GLKlh6CvsBsGYX+krWxQpaiizcc9FjDnnaCc11dXR2lyxyjsuyPy3/Lg4CM0k8v3Ut58Dc5C9C22XHQVVeoQrwkQVaCPKtuKQZQhCcdv78gSg4zzPlpxg3bTEeSUzcR7Q2bWyvz+ytmQr8NPAow/ikAxRYA/kQAr/hPByxQC8cxLsHggAkzH56uv/XrdvgA='),
    this.createVertexTemplateEntry('swimlane;startSize=20;', 120, 320, 'Lane', 'Vertical Swimlane', null, null, 'swimlane lane pool'),
    this.createVertexTemplateEntry('rounded=1;arcSize=10;dashed=1;strokeColor=#000000;fillColor=none;gradientColor=none;dashPattern=8 3 1 3;strokeWidth=2;',
      200, 200, '', 'Group', null, null, this.getTagsForStencil('bpmn', 'group', 'bpmn business process model ').join(' ')),
    this.createEdgeTemplateEntry('endArrow=block;endFill=1;endSize=14;html=1;', 100, 0, '', 'Sequence Flow', null, 'bpmn sequence flow'),
    this.createEdgeTemplateEntry('startArrow=dash;startSize=8;endArrow=block;endFill=1;endSize=14;html=1;', 100, 0, '', 'Default Flow', null, 'bpmn default flow'),
    this.createEdgeTemplateEntry('startArrow=diamondThin;startSize=18;startFill=0;startSize=18;endArrow=block;endFill=1;endSize=14;html=1;', 100, 0, '', 'Conditional Flow', null, 'bpmn conditional flow'),
    this.createEdgeTemplateEntry('startArrow=oval;startFill=0;startSize=7;endArrow=block;endFill=0;endSize=10;dashed=1;html=1;', 100, 0, '', 'Message Flow 1', null, 'bpmn message flow'),
    this.addEntry('bpmn message flow', function () {
      var edge = new mxCell('', new mxGeometry(0, 0, 0, 0), 'startArrow=oval;startFill=0;startSize=7;endArrow=block;endFill=0;endSize=10;dashed=1;html=1;');
      edge.geometry.setTerminalPoint(new mxPoint(0, 0), true);
      edge.geometry.setTerminalPoint(new mxPoint(100, 0), false);
      edge.geometry.relative = true;
      edge.edge = true;

      var cell = new mxCell('', new mxGeometry(0, 0, 20, 14), 'shape=message;html=1;outlineConnect=0;');
      cell.geometry.relative = true;
      cell.vertex = true;
      cell.geometry.offset = new mxPoint(-10, -7);
      edge.insert(cell);

      return sb.createEdgeTemplateFromCells([edge], 100, 0, 'Message Flow 2');
    }),
    this.createEdgeTemplateEntry('shape=link;html=1;', 100, 0, '', 'Link', null, 'bpmn link')
  ];

  this.addPaletteFunctions('bpmn', 'BPMN ' + mxResources.get('general'), false, fns);
  this.setCurrentSearchEntryLibrary();
};

/**
 * 创建并返回指定标题元素。
 * 生成用于侧边栏调色板标题的DOM元素。
 *
 * @param {string} label - 标题文本内容
 * @returns {HTMLElement} 创建的标题元素
 */
Sidebar.prototype.createTitle = function (label) {
  var elt = document.createElement('a');
  elt.setAttribute('title', mxResources.get('sidebarTooltip'));
  elt.className = 'geTitle';
  mxUtils.write(elt, label);

  return elt;
};

/**
 * 为指定的单元格创建缩略图。
 * 在临时图形实例中渲染单元格，生成缩放后的缩略图并添加到父容器中。
 *
 * @param {Array} cells - 要渲染的单元格数组
 * @param {number} width - 缩略图宽度
 * @param {number} height - 缩略图高度
 * @param {HTMLElement} parent - 父容器元素
 * @param {string} title - 缩略图标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} showTitle - 是否显示标题
 * @param {number} realWidth - 实际宽度
 * @param {number} realHeight - 实际高度
 * @param {boolean} addCells - 是否添加单元格到图形中，默认为true
 * @returns {mxRectangle} 图形的边界框
 */
Sidebar.prototype.createThumb = function (cells, width, height, parent, title, showLabel, showTitle, realWidth, realHeight, addCells = true) {
  this.graph.labelsVisible = (showLabel == null || showLabel);
  var fo = mxClient.NO_FO;
  mxClient.NO_FO = Editor.prototype.originalNoForeignObject;
  this.graph.view.scaleAndTranslate(1, 0, 0);
  addCells && this.graph.addCells(cells);
  var bounds = this.graph.getGraphBounds();
  var s = Math.floor(Math.min((width - 2 * this.thumbBorder) / bounds.width,
    (height - 2 * this.thumbBorder) / bounds.height) * 100) / 100;
  this.graph.view.scaleAndTranslate(s, Math.floor((width - bounds.width * s) / 2 / s - bounds.x),
    Math.floor((height - bounds.height * s) / 2 / s - bounds.y));
  var node = null;

  // 为在IE9标准模式下支持HTML标签，容器被克隆代替
  if (this.graph.dialect == mxConstants.DIALECT_SVG && !mxClient.NO_FO &&
    this.graph.view.getCanvas().ownerSVGElement != null) {
    node = this.graph.view.getCanvas().ownerSVGElement.cloneNode(true);
  }
  // 稍后: 如果容器在DOM中，检查是否可以使用深度克隆用于怪异模式
  else {
    node = this.graph.container.cloneNode(false);
    node.innerHTML = this.graph.container.innerHTML;
  }

  this.graph.getModel().clear();
  mxClient.NO_FO = fo;

  node.style.position = 'relative';
  node.style.overflow = 'hidden';
  node.style.left = this.thumbBorder + 'px';
  node.style.top = this.thumbBorder + 'px';
  node.style.width = width + 'px';
  node.style.height = height + 'px';
  node.style.visibility = '';
  node.style.minWidth = '';
  node.style.minHeight = '';

  parent.appendChild(node);

  // 为侧边栏条目添加标题
  if (this.sidebarTitles && title != null && showTitle != false) {
    var border = 0;
    parent.style.height = (this.thumbHeight + border + this.sidebarTitleSize + 8) + 'px';

    var div = document.createElement('div');
    div.style.fontSize = this.sidebarTitleSize + 'px';
    div.style.color = '#303030';
    div.style.textAlign = 'center';
    div.style.whiteSpace = 'nowrap';

    if (mxClient.IS_IE) {
      div.style.height = (this.sidebarTitleSize + 12) + 'px';
    }

    div.style.paddingTop = '4px';
    mxUtils.write(div, title);
    parent.appendChild(div);
  }

  return bounds;
};

/**
 * 返回一个创建节标题的函数。
 * 生成用于分组显示的节标题元素。
 *
 * @param {string} title - 节标题文本
 * @returns {Function} 创建节标题元素的函数
 */
Sidebar.prototype.createSection = function (title) {
  return mxUtils.bind(this, function () {
    var elt = document.createElement('div');
    elt.setAttribute('title', title);
    elt.style.textOverflow = 'ellipsis';
    elt.style.whiteSpace = 'nowrap';
    elt.style.textAlign = 'center';
    elt.style.overflow = 'hidden';
    elt.style.width = '100%';
    elt.style.padding = '14px 0';

    mxUtils.write(elt, title);

    return elt;
  });
};

/**
 * 为侧边栏项目创建标题元素。
 * 在指定的容器元素中添加标题文本。
 *
 * @param {Array} cells - 单元格数组（未使用）
 * @param {number} width - 宽度（未使用）
 * @param {number} height - 高度（未使用）
 * @param {HTMLElement} elt - 容器元素
 * @param {string} title - 标题文本
 */
Sidebar.prototype.createItemTitle = (cells, width, height, elt, title) => {
  const text = document.createElement('span');
  text.style.marginLeft = '10px'
  text.style.fontSize = '13px'
  text.innerText = title
  elt.appendChild(text)
}

/**
 * 为图元设置图标。
 * 根据单元格的metaId属性查找对应的图标，并替换元素中的默认图标。
 *
 * @param {HTMLElement} elt - 要设置图标的DOM元素
 * @param {mxCell} cell - 包含metaId属性的单元格
 */
Sidebar.prototype.setIcon = function (elt, cell) {
  if (cell.isElement()) {
    const metaId = cell.getAttribute("metaId");
    const modelIcons = window.DrawioStore.graphData.icons;
    const icon = modelIcons && modelIcons[metaId]
    if (icon) {
      const img = document.createElement('img')
      img.onload = function () {
        elt.removeChild(elt.children[0])
        elt.prepend(img)
        cell.setAttribute('icon', icon)
      }
      img.onerror = function () {
        console.warn('找不到' + icon)
      }
      img.src = '../../../../../static/drawio/img/' + icon;
      img.style.width = '30px'
      img.style.height = '20px'
    }
  }
}

/**
 * 合并多个样式对象或字符串。
 * 将多个样式参数合并为一个样式字符串，支持字符串和对象格式。
 *
 * @param {...(string|Object)} args - 要合并的样式参数
 * @returns {string} 合并后的样式字符串
 */
function mergeStyle(...args) {
  const addStyles = []
  args.forEach(arg => {
    if (!arg) return
    addStyles.push(typeof arg === 'string' ? mxUtils.parseStyle(arg) : arg)
  })
  if (!addStyles.length) {
    return {}
  }
  return mxUtils.stringifyStyle(Object.assign({}, ...addStyles))
}

/**
 * 为单元格添加额外的激活样式。
 * 根据单元格的metaId属性查找对应的样式配置并应用到单元格上。
 *
 * @param {mxCell} cell - 要设置样式的单元格
 */
Sidebar.prototype.addActiveStyle = function (cell) {
  if (cell.value && cell.value instanceof Object) {
    const metaId = cell.value.getAttribute("metaId");
    const activeStyle = window.styleMap && window.styleMap[metaId]
    let defaultStyle = {};
    if (cell.value.nodeName !== 'relation') {
      defaultStyle = {
        fillColor: '#DAE8FC',
        strokeColor: '#003770'
      }
    } else if (cell.value.nodeName === 'relation') {
      defaultStyle = {
        labelBackgroundColor: 'none'
      }
    }
    /**
     * 所有元素label不换行，超出省略
     * http://192.168.0.100:8000/zentao/bug-view-22113.html
     *
     * 通过指定overflow和whiteSpace style实现
     * overflow 优先级低，可被原有样式覆盖
     * whiteSpace 优先级高，覆盖以原有样式
     */
    var overflowStyle = {};
    var whitespaceStyle = {};

    var cellStyleTemp = cell.style + (activeStyle || '');

    // label是否居中，只有居中才超出省略
    var isLabelCenter = (!cellStyleTemp.includes('labelPosition') && !cellStyleTemp.includes('verticalLabelPosition')) || (cellStyleTemp.includes('labelPosition=center;') && cellStyleTemp.includes('verticalLabelPosition=middle;'));

    if (!(window.displayTypeComboStr.includes(GraphEventUtils.getDisplay(cell)) || cell.style.includes('shape=umlLifeline;') || cell.style.includes('swimlane') || cell.isEdge()) && isLabelCenter) {
      overflowStyle.overflow = 'width';
      whitespaceStyle[mxConstants.STYLE_WHITE_SPACE] = 'nowrap';
    }
    (activeStyle || defaultStyle) && cell.setStyle(mergeStyle(defaultStyle, overflowStyle, mxUtils.parseStyle(cell.style || ''), activeStyle, whitespaceStyle))
  }
}

/**
 * 创建并返回给定图像的新调色板项目。
 * 为指定的单元格创建可拖拽的侧边栏项目，包括缩略图、标题和交互功能。
 *
 * @param {Array} cells - 要创建项目的单元格数组
 * @param {string} title - 项目标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} showTitle - 是否显示标题
 * @param {number} width - 项目宽度
 * @param {number} height - 项目高度
 * @param {boolean} allowCellsInserted - 是否允许插入单元格
 * @returns {HTMLElement} 创建的项目元素
 */
Sidebar.prototype.createItem = function (cells, title, showLabel, showTitle, width, height, allowCellsInserted) {
  if (!this.editorUi.editor) {
    this.editorUi = myEditor;
  }
  var elt = document.createElement('a');
  elt.className = 'geItem';
  elt.style.display = 'inline-flex';
  elt.style.alignItems = 'center';
  elt.style.overflow = 'hidden';
  var border = 2 * this.thumbBorder;
  elt.style.width = '100%' // (this.thumbWidth + border) + 'px';
  elt.style.height = (this.thumbHeight + border) + 'px';
  elt.style.padding = this.thumbPadding + 'px';

  // 是否是关系线
  elt.setAttribute('edge', !!cells[0].edge)

  // 阻止默认点击动作
  mxEvent.addListener(elt, 'click', function (evt) {
    mxEvent.consume(evt);
  });

  // 给cell添加从框架配置来的样式
  this.addActiveStyle(cells[0]);

  // 将所有display对应的cell-style保存
  this.saveCellAndStyleByDisplay(cells[0])

  // 添加svg图标
  window.showThumb && this.createThumb(cells, this.thumbWidth, this.thumbHeight, elt, title, showLabel, showTitle, width, height, true);

  //替换图元icon
  this.setIcon(elt, cells[0]);

  // 添加title
  this.createItemTitle(cells, this.thumbWidth, this.thumbHeight, elt, title);

  var bounds = new mxRectangle(0, 0, width, height);

  if ((cells.length > 1 || cells[0].vertex)) { // 节点引用只能拖拽创建
    var ds = this.createDragSource(elt, this.createDropHandler(cells, true, allowCellsInserted,
      bounds), this.createDragPreview(width, height), cells, bounds);
    this.addClickHandler(elt, ds, cells);

    // 仅在图形中启用辅助线时才为顶点使用辅助线
    // 对齐指引
    ds.isGuidesEnabled = mxUtils.bind(this, function () {
      return this.editorUi && this.editorUi.editor && this.editorUi.editor.graph && this.editorUi.editor.graph.graphHandler && this.editorUi.editor.graph.graphHandler.guidesEnabled;
    });
  } else if (cells[0] != null && cells[0].edge) {
    var ds = this.createDragSource(elt, this.createDropHandler(cells, false, allowCellsInserted, bounds), this.createDragPreview(width, height), cells, bounds);
    this.addClickHandler(elt, ds, cells);
  }

  // 显示包含渲染单元格的工具提示
  if (!mxClient.IS_IOS) {
    mxEvent.addGestureListeners(elt, null, mxUtils.bind(this, function (evt) {
      if (mxEvent.isMouseEvent(evt)) {
        if (!window.isSysml) {
          this.showTooltip(elt, cells, bounds.width, bounds.height, title, showLabel);
        }
      }
    }));
  }

  if (ds) {
    elt.__mx_dragSource = ds;
  }

  return elt;
};

/**
 * 更新形状样式。
 * 将源单元格的样式属性应用到目标单元格上，实现样式同步。
 *
 * @param {mxCell} source - 源单元格，样式来源
 * @param {Array} targets - 目标单元格数组，要应用样式的单元格
 * @returns {Array} 更新后的单元格数组
 */
Sidebar.prototype.updateShapes = function (source, targets) {
  var graph = this.editorUi.editor.graph;
  var sourceCellStyle = graph.getCellStyle(source);
  var result = [];

  graph.model.beginUpdate();
  try {
    var cellStyle = graph.getModel().getStyle(source);

    // 列出要从现有形状继承的样式属性
    var styles = ['shadow', 'dashed', 'dashPattern', 'fontFamily', 'fontSize', 'fontColor', 'align', 'startFill',
      'startSize', 'endFill', 'endSize', 'strokeColor', 'strokeWidth', 'fillColor', 'gradientColor',
      'html', 'part', 'noEdgeStyle', 'edgeStyle', 'elbow', 'childLayout', 'recursiveResize',
      'container', 'collapsible', 'connectable', 'comic', 'sketch', 'fillWeight', 'hachureGap',
      'hachureAngle', 'jiggle', 'disableMultiStroke', 'disableMultiStrokeFill',
      'fillStyle', 'curveFitting', 'simplification', 'sketchStyle'
    ];

    for (var i = 0; i < targets.length; i++) {
      var targetCell = targets[i];

      if ((graph.getModel().isVertex(targetCell) == graph.getModel().isVertex(source)) ||
        (graph.getModel().isEdge(targetCell) == graph.getModel().isEdge(source))) {
        var style = graph.getCurrentCellStyle(targets[i]);
        graph.getModel().setStyle(targetCell, cellStyle);

        // 移除复合单元格的所有子元素
        if (mxUtils.getValue(style, 'composite', '0') == '1') {
          var childCount = graph.model.getChildCount(targetCell);

          for (var j = childCount; j >= 0; j--) {
            graph.model.remove(graph.model.getChildAt(targetCell, j));
          }
        }

        // 将生命线形状中的参与者样式替换为目标形状
        if (style[mxConstants.STYLE_SHAPE] == 'umlLifeline' &&
          sourceCellStyle[mxConstants.STYLE_SHAPE] != 'umlLifeline') {
          graph.setCellStyles(mxConstants.STYLE_SHAPE, 'umlLifeline', [targetCell]);
          graph.setCellStyles('participant', sourceCellStyle[mxConstants.STYLE_SHAPE], [targetCell]);
        }

        for (var j = 0; j < styles.length; j++) {
          var value = style[styles[j]];

          if (value != null) {
            graph.setCellStyles(styles[j], value, [targetCell]);
          }
        }

        result.push(targetCell);
      }
    }
  } finally {
    graph.model.endUpdate();
  }

  return result;
};

/**
 * 判断单元格是否为生命线类型。
 * 检查单元格是否为UML生命线元素，用于时序图中的生命线识别。
 *
 * @param {mxCell} cell - 要检查的单元格
 * @returns {boolean} 如果是生命线单元格返回true，否则返回false
 */
const isLifeLineCell = (cell) => cell && cell.isElement() && window.displayTypeComboStr.includes(cell.value.getAttribute('display')) || (cell.style && cell.style.includes("shape=umlLifeline;"))
/**
 * 重写引用单元格的内容和样式。
 * 因为每个模型的引用单元格形状是不确定的，所以每次引用都需要从接口查询得到新的单元格数据。
 * 该方法会异步获取最新的单元格XML数据，并更新单元格的值、样式和几何属性。
 *
 * @param {mxCell} cell - 要重写的引用单元格
 * @returns {Promise<mxCell>} 返回更新后的单元格
 */
Sidebar.prototype.rewriteQuoteCell = async function (cell) {
  const graph = myEditor.editor.graph
  cell = graph.cloneCell(cell)
  if (cell.isElement() && cell.value.getAttribute('selectQuote') === 'false') {
    // 数据定义引用 切换数据
    const res = await window.$axios.post(contextPath + '/sysmlDefineNode/getQuoteXmlNodeString', {
      'id': cell.value.getAttribute('cellId'),
      'name': cell.value.getAttribute('name'),
      'metaId': cell.value.getAttribute('metaId')
    }, )
    if (res.statusCode === 200) {
      if (res.data.xmlString) {
        const newXml = mxUtils.parseXml(res.data.xmlString).documentElement
        if (newXml.children && newXml.children.length) {
          const syncValue = newXml.children[0]
          if (res.data.isNewObject) {
            const entityCellInfo = this.cellAndStyleMap.find(i => i.metaId === res.data.metaId && i.name === newXml.children[0].getAttribute('name'))
            if (entityCellInfo.cell) {
              cell.geometry = entityCellInfo.cell.geometry.clone()
              cell.style = entityCellInfo.cell.style
              syncValue.setAttribute('label', res.data.params.name)
            }
          }
          window.saveCell = true
          // createFns，得到style
          const fs = this.createFns(`<?xml version="1.0" encoding="UTF-8"?><root>${res.data.xmlString}</root>`);
          fs[0]();
          // 获取对应的display
          const entityCellInfo = this.cellAndStyleMap.find(i => {
            return syncValue.nodeName === i.nodeName && i.metaId === syncValue.getAttribute('metaId') && syncValue.getAttribute('name') === i.name
          })
          // 引用
          syncValue.setAttribute('cellId', syncValue.getAttribute('quoteId'))
          syncValue.setAttribute('selectQuote', cell.value.getAttribute('selectQuote'))
          syncValue.setAttribute('isInit', cell.value.getAttribute('isInit'))
          syncValue.setAttribute('treeNodeId', cell.value.getAttribute('treeNodeId'))
          if (cell.curDragNodes && cell.curDragNodes.type === "quote_object") {
            syncValue.setAttribute('editable', 'false')
          }
          if (entityCellInfo) {
            cell = graph.cloneCell(entityCellInfo.cell)
            if (entityCellInfo.type === 'GROUP') {
              const cloneCells = graph.cloneCells(entityCellInfo.parent);

              if (!cloneCells[0].geometry) {
                cloneCells[0].geometry = new mxGeometry
              }
              return cloneCells[0]
            }
          }
          cell.value = syncValue
          if (isLifeLineCell(cell)) {
            let strLength = syncValue.getAttribute('label').length;
            cell.style = 'shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;'
            cell.geometry.width = Math.max(100, (strLength * 12) + 10)
            cell.geometry.height = 300 // 高度为当前时序图最大高度
          }
        }
      }

      this.addActiveStyle(cell);
    }
  }
  return cell
}
/**
 * 拖拽释放后的后处理操作。
 * 处理单元格拖拽到画布后的各种业务逻辑，包括引用处理、标签更新等。
 *
 * @param {mxCell} cell - 被拖拽释放的单元格
 */
Sidebar.prototype.afterDrop = function (cell) {
  const graph = window.myEditor.editor.graph
  const selectQuote = (cell) => {
    cell.value.setAttribute('cellId', cell.value.getAttribute('quoteId'))
    // 引用，设置objectId
    drawioBus.$emit('quoteAndSetObjectId', cell, async () => {
      const util = new utils()
      await util.putLabel(cell, cell.getAttribute('name'), resolveCell(cell), cell.getAttribute('label'))
      // 添加元素下标
      await getObjectNameInfo(cell.getValue(), cell);

      graph.redrawLabel(cell)

      util.updateCellSizeImmediate(cell);
    });
  }
  // 拖拽引用，不需要打开弹窗，组需要循环引用它的子节点
  if (cell.style.includes('group')) {
    cell.children.forEach(item => {
      if (item.value instanceof Object && item.value.tagName === 'quote') {
        selectQuote(item)
      }
    })
  }
  // 拖拽引用，不需要打开弹窗
  if (cell && cell.value instanceof Object && cell.value.getAttribute('selectQuote') === 'false') {
    // 时序图拖拽引用时，手动设置objectLabel属性，在putLabel方法中可以正确设置label
    if (window.displayTypeComboStr.includes(GraphEventUtils.getDisplay(cell))) {
      cell.objectLabel = cell.value.getAttribute('label');
    }
    selectQuote(cell)
  } else if (cell && typeof (cell.value) == 'object' && cell.value != null && cell.value.nodeName == 'quote') {
    // 打开引用窗口
    myEditor.actions.get('toggleQuote').funct();
  }

  if (cell && typeof (cell.value) == 'object' && cell.value != null && (cell.value.attributes.class_flag != null && cell.value.attributes.class_flag.value == "1")) {
    myEditor.actions.get('copyClass').funct();
  }
  if (cell && typeof (cell.value) == 'object' && cell.value != null && cell.value.nodeName == 'relaentity' && (cell.value.attributes.newType != null && cell.value.attributes.newType.value == "quote")) {
    myEditor.actions.get('toggleQuote').funct();
  }
}
/**
 * 创建拖拽处理器。
 * 为指定的单元格创建拖拽释放处理器，处理将元素拖拽到画布上的逻辑。
 *
 * @param {Array} _cells - 要插入的单元格数组
 * @param {boolean} allowSplit - 是否允许分割目标
 * @param {boolean} allowCellsInserted - 是否允许插入单元格
 * @param {mxRectangle} bounds - 边界矩形
 * @returns {Function} 拖拽释放处理器函数
 */
Sidebar.prototype.createDropHandler = function (_cells, allowSplit, allowCellsInserted, bounds) {
  allowCellsInserted = (allowCellsInserted != null) ? allowCellsInserted : true;

  return mxUtils.bind(this, async function (graph, evt, target, x, y, force) {
    // 获取事件源元素，用于判断拖拽是否发生在侧边栏内部
    var elt = (force) ? null : ((mxEvent.isTouchEvent(evt) || mxEvent.isPenEvent(evt)) ?
      document.elementFromPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt)) :
      mxEvent.getSource(evt));

    // 向上遍历DOM树，检查是否在侧边栏容器内
    while (elt != null && elt != this.container) {
      elt = elt.parentNode;
    }

    // 确保坐标不小于0
    x = Math.max(0, x)
    y = Math.max(0, y)

    if (elt == null && graph.isEnabled()) {
      // 过滤非法端口，感觉此处逻辑加在canImportCell里更好，能兼容处理复制粘贴的场景
      let cells = graph.model.filterCells(_cells, mxUtils.bind(this, function (cell) {
        return graph.canImportCell(cell) && myEditor.graphEvent.allowCellInsert(target || graph.getDefaultParent(), cell, {
          showMessage: true
        })
      }))

      if (cells.length > 0) {
        cells = await Promise.all(cells.map(cell => {
          isLifeLineCell(cell) && (y = 70)
          return this.rewriteQuoteCell(cell)
        }));
        graph.stopEditing();

        // 在释放鼠标时按住Alt键会忽略拖拽目标
        var validDropTarget = (target != null && !mxEvent.isAltDown(evt)) ?
          graph.isValidDropTarget(target, cells, evt) : false;

        var select = null;

        if (target != null && !validDropTarget) {
          target = null;
        }

        if (!graph.isCellLocked(target || graph.getDefaultParent())) {
          graph.model.beginUpdate();
          try {
            x = Math.round(x);
            y = Math.round(y);

            // 分割目标边或插入到目标组中
            if (allowSplit && graph.isSplitTarget(target, cells, evt)) {
              var s = graph.view.scale;
              var tr = graph.view.translate;
              var tx = (x + tr.x) * s;
              var ty = (y + tr.y) * s;

              var clones = graph.cloneCells(cells);
              graph.splitEdge(target, clones, null,
                x - bounds.width / 2, y - bounds.height / 2,
                tx, ty);
              select = clones;
            } else if (cells.length > 0) {
              // 是否允许两元素包含，target为根元素时不判断
              const containable = target ? cells.every(cell => myEditor.graphEvent.getMouseEnterEnabled(target, cell)) : true
              allowCellsInserted = allowCellsInserted && containable
              select = graph.importCells(cells, x, y, containable ? target : null);
            }

            // 执行父级布局钩子以处理位置/顺序
            if (graph.layoutManager != null) {
              var layout = graph.layoutManager.getLayout(target);

              if (layout != null) {
                var s = graph.view.scale;
                var tr = graph.view.translate;
                var tx = (x + tr.x) * s;
                var ty = (y + tr.y) * s;

                for (var i = 0; i < select.length; i++) {
                  layout.moveCell(select[i], tx, ty);
                }
              }
            }

            if (allowCellsInserted && (evt == null || !mxEvent.isShiftDown(evt))) {
              graph.fireEvent(new mxEventObject('cellsInserted', 'cells', select));
            }
          } catch (e) {
            this.editorUi.handleError(e);
          } finally {
            graph.model.endUpdate();
          }

          if (select != null && select.length > 0) {
            graph.scrollCellToVisible(select[0]);
            graph.setSelectionCells(select);
            this.afterDrop(select[0])
          }

          if (graph.editAfterInsert && evt != null && mxEvent.isMouseEvent(evt) &&
            select != null && select.length == 1) {
            window.setTimeout(function () {
              graph.startEditing(select[0]);
            }, 0);
          }
        }
      }

      mxEvent.consume(evt);
    }
  });
};

/**
 * 创建并返回指定宽度和高度的预览元素。
 * 生成拖拽过程中显示的预览边框元素。
 *
 * @param {number} width - 预览元素的宽度
 * @param {number} height - 预览元素的高度
 * @returns {HTMLElement} 创建的预览元素
 */
Sidebar.prototype.createDragPreview = function (width, height) {
  var elt = document.createElement('div');
  elt.style.border = this.dragPreviewBorder;
  elt.style.width = width + 'px';
  elt.style.height = height + 'px';

  return elt;
};

/**
 * 拖拽并连接。
 * 将源单元格拖拽到目标单元格上并创建连接关系，用于建立图形元素之间的连接。
 *
 * @param {mxCell} source - 源单元格
 * @param {Array} targets - 目标单元格数组
 * @param {string} direction - 连接方向
 * @param {number} dropCellIndex - 要连接的目标单元格索引
 * @param {Event} evt - 鼠标事件
 * @returns {Array} 选中的单元格数组
 */
Sidebar.prototype.dropAndConnect = function (source, targets, direction, dropCellIndex, evt) {
  var geo = this.getDropAndConnectGeometry(source, targets[dropCellIndex], direction, targets);

  // 用于选择的不包含新边的目标
  var tmp = [];

  if (geo != null) {
    var graph = this.editorUi.editor.graph;
    var editingCell = null;

    graph.model.beginUpdate();
    try {
      var sourceGeo = graph.getCellGeometry(source);
      var geo2 = graph.getCellGeometry(targets[dropCellIndex]);

      // 处理目标应该被栈布局忽略的特殊情况
      var targetParent = graph.model.getParent(source);
      var validLayout = true;

      // 如果父级有栈布局或它是表格或行，则忽略父级
      if (graph.layoutManager != null) {
        var layout = graph.layoutManager.getLayout(targetParent);

        // 稍后: 如果有效布局则使用父级的父级
        if (layout != null && layout.constructor == mxStackLayout) {
          validLayout = false;
        }
      }

      // 检查拖拽位置是否有另一个容器
      var tmp = (graph.model.isEdge(source)) ? null : graph.view.getState(targetParent);
      var dx = 0;
      var dy = 0;

      // 通过父级位置进行偏移
      if (tmp != null) {
        var offset = tmp.origin;
        dx = offset.x;
        dy = offset.y;

        var pt = geo.getTerminalPoint(false);

        if (pt != null) {
          pt.x += offset.x;
          pt.y += offset.y;
        }
      }

      var useParent = !graph.isTableRow(source) && !graph.isTableCell(source) &&
        (graph.model.isEdge(source) || (sourceGeo != null &&
          !sourceGeo.relative && validLayout));

      var tempTarget = graph.getCellAt((geo.x + dx + graph.view.translate.x) * graph.view.scale,
        (geo.y + dy + graph.view.translate.y) * graph.view.scale, null, null, null,
        function (state, x, y) {
          return !graph.isContainer(state.cell);
        });

      if (tempTarget != null && tempTarget != targetParent) {
        tmp = graph.view.getState(tempTarget);

        // 通过新父级位置进行偏移
        if (tmp != null) {
          var offset = tmp.origin;
          targetParent = tempTarget;
          useParent = true;

          if (!graph.model.isEdge(source)) {
            geo.x -= offset.x - dx;
            geo.y -= offset.y - dy;
          }
        }
      } else if (!validLayout || graph.isTableRow(source) || graph.isTableCell(source)) {
        geo.x += dx;
        geo.y += dy;
      }

      dx = geo2.x;
      dy = geo2.y;

      // 忽略边的几何信息
      if (graph.model.isEdge(targets[dropCellIndex])) {
        dx = 0;
        dy = 0;
      }

      targets = graph.importCells(targets, (geo.x - (useParent ? dx : 0)),
        (geo.y - (useParent ? dy : 0)), (useParent) ? targetParent : null);
      tmp = targets;

      if (graph.model.isEdge(source)) {
        // 为边添加新的终端
        // 稍后: 从边起点向外辐射推新终端
        graph.model.setTerminal(source, targets[dropCellIndex],
          direction == mxConstants.DIRECTION_NORTH);
      } else if (graph.model.isEdge(targets[dropCellIndex])) {
        // 为顶点添加新的传出连接并清除点
        graph.model.setTerminal(targets[dropCellIndex], source, true);
        var geo3 = graph.getCellGeometry(targets[dropCellIndex]);
        geo3.points = null;

        if (geo3.getTerminalPoint(false) != null) {
          geo3.setTerminalPoint(geo.getTerminalPoint(false), false);
        } else if (useParent && graph.model.isVertex(targetParent)) {
          // 为其他节点添加父级偏移
          var tmpState = graph.view.getState(targetParent);
          var offset = (tmpState.cell != graph.view.currentRoot) ?
            tmpState.origin : new mxPoint(0, 0);

          graph.cellsMoved(targets, offset.x, offset.y, null, null, true);
        }
      } else {
        geo2 = graph.getCellGeometry(targets[dropCellIndex]);
        dx = geo.x - Math.round(geo2.x);
        dy = geo.y - Math.round(geo2.y);
        geo.x = Math.round(geo2.x);
        geo.y = Math.round(geo2.y);
        graph.model.setGeometry(targets[dropCellIndex], geo);
        graph.cellsMoved(targets, dx, dy, null, null, true);
        tmp = targets.slice();
        editingCell = (tmp.length == 1) ? tmp[0] : null;
        targets.push(graph.insertEdge(null, null, '', source, targets[dropCellIndex],
          graph.createCurrentEdgeStyle()));
      }

      if (evt == null || !mxEvent.isShiftDown(evt)) {
        graph.fireEvent(new mxEventObject('cellsInserted', 'cells', targets));
      }
    } catch (e) {
      this.editorUi.handleError(e);
    } finally {
      graph.model.endUpdate();
    }

    if (graph.editAfterInsert && evt != null && mxEvent.isMouseEvent(evt) &&
      editingCell != null) {
      window.setTimeout(function () {
        graph.startEditing(editingCell);
      }, 0);
    }
  }

  return tmp;
};

/**
 * Creates a drag source for the given element.
 */
Sidebar.prototype.getDropAndConnectGeometry = function (source, target, direction, targets) {
  var graph = this.editorUi.editor.graph;
  var view = graph.view;
  var keepSize = targets.length > 1;
  var geo = graph.getCellGeometry(source);
  var geo2 = graph.getCellGeometry(target);

  if (geo != null && geo2 != null) {
    geo2 = geo2.clone();

    if (graph.model.isEdge(source)) {
      var state = graph.view.getState(source);
      var pts = state.absolutePoints;
      var p0 = pts[0];
      var pe = pts[pts.length - 1];

      if (direction == mxConstants.DIRECTION_NORTH) {
        geo2.x = p0.x / view.scale - view.translate.x - geo2.width / 2;
        geo2.y = p0.y / view.scale - view.translate.y - geo2.height / 2;
      } else {
        geo2.x = pe.x / view.scale - view.translate.x - geo2.width / 2;
        geo2.y = pe.y / view.scale - view.translate.y - geo2.height / 2;
      }
    } else {
      if (geo.relative) {
        var state = graph.view.getState(source);
        geo = geo.clone();
        geo.x = (state.x - view.translate.x) / view.scale;
        geo.y = (state.y - view.translate.y) / view.scale;
      }

      var length = graph.defaultEdgeLength;

      // 保持边长度
      if (graph.model.isEdge(target) && geo2.getTerminalPoint(true) != null &&
        geo2.getTerminalPoint(false) != null) {
        var p0 = geo2.getTerminalPoint(true);
        var pe = geo2.getTerminalPoint(false);
        var dx = pe.x - p0.x;
        var dy = pe.y - p0.y;

        length = Math.sqrt(dx * dx + dy * dy);

        geo2.x = geo.getCenterX();
        geo2.y = geo.getCenterY();
        geo2.width = 1;
        geo2.height = 1;

        if (direction == mxConstants.DIRECTION_NORTH) {
          geo2.height = length
          geo2.y = geo.y - length;
          geo2.setTerminalPoint(new mxPoint(geo2.x, geo2.y), false);
        } else if (direction == mxConstants.DIRECTION_EAST) {
          geo2.width = length
          geo2.x = geo.x + geo.width;
          geo2.setTerminalPoint(new mxPoint(geo2.x + geo2.width, geo2.y), false);
        } else if (direction == mxConstants.DIRECTION_SOUTH) {
          geo2.height = length
          geo2.y = geo.y + geo.height;
          geo2.setTerminalPoint(new mxPoint(geo2.x, geo2.y + geo2.height), false);
        } else if (direction == mxConstants.DIRECTION_WEST) {
          geo2.width = length
          geo2.x = geo.x - length;
          geo2.setTerminalPoint(new mxPoint(geo2.x, geo2.y), false);
        }
      } else {
        // 尝试匹配大小或忽略如果宽度或高度小于45
        // is considered special enough to be ignored here
        if (!keepSize && geo2.width > 45 && geo2.height > 45 &&
          geo.width > 45 && geo.height > 45) {
          geo2.width = geo2.width * (geo.height / geo2.height);
          geo2.height = geo.height;
        }

        geo2.x = geo.x + geo.width / 2 - geo2.width / 2;
        geo2.y = geo.y + geo.height / 2 - geo2.height / 2;

        if (direction == mxConstants.DIRECTION_NORTH) {
          geo2.y = geo2.y - geo.height / 2 - geo2.height / 2 - length;
        } else if (direction == mxConstants.DIRECTION_EAST) {
          geo2.x = geo2.x + geo.width / 2 + geo2.width / 2 + length;
        } else if (direction == mxConstants.DIRECTION_SOUTH) {
          geo2.y = geo2.y + geo.height / 2 + geo2.height / 2 + length;
        } else if (direction == mxConstants.DIRECTION_WEST) {
          geo2.x = geo2.x - geo.width / 2 - geo2.width / 2 - length;
        }

        // 添加偏移以匹配不连接边的单元格
        if (graph.model.isEdge(target) && geo2.getTerminalPoint(true) != null &&
          target.getTerminal(false) != null) {
          var targetGeo = graph.getCellGeometry(target.getTerminal(false));

          if (targetGeo != null) {
            if (direction == mxConstants.DIRECTION_NORTH) {
              geo2.x -= targetGeo.getCenterX();
              geo2.y -= targetGeo.getCenterY() + targetGeo.height / 2;
            } else if (direction == mxConstants.DIRECTION_EAST) {
              geo2.x -= targetGeo.getCenterX() - targetGeo.width / 2;
              geo2.y -= targetGeo.getCenterY();
            } else if (direction == mxConstants.DIRECTION_SOUTH) {
              geo2.x -= targetGeo.getCenterX();
              geo2.y -= targetGeo.getCenterY() - targetGeo.height / 2;
            } else if (direction == mxConstants.DIRECTION_WEST) {
              geo2.x -= targetGeo.getCenterX() + targetGeo.width / 2;
              geo2.y -= targetGeo.getCenterY();
            }
          }
        }
      }
    }
  }

  return geo2;
};

/**
 * Limits drop style to non-transparent source shapes.
 */
Sidebar.prototype.isDropStyleEnabled = function (cells, firstVertex) {
  var result = true;

  if (firstVertex != null && cells.length == 1) {
    var vstyle = this.graph.getCellStyle(cells[firstVertex]);

    if (vstyle != null) {
      result = mxUtils.getValue(vstyle, mxConstants.STYLE_STROKECOLOR, mxConstants.NONE) != mxConstants.NONE ||
        mxUtils.getValue(vstyle, mxConstants.STYLE_FILLCOLOR, mxConstants.NONE) != mxConstants.NONE;
    }
  }

  return result;
};

/**
 * Ignores swimlanes as drop style targets.
 */
Sidebar.prototype.isDropStyleTargetIgnored = function (state) {
  return this.graph.isSwimlane(state.cell) || this.graph.isTableCell(state.cell) ||
    this.graph.isTableRow(state.cell) || this.graph.isTable(state.cell);
};

/**
 * 创建拖拽源。
 * 为指定的DOM元素创建拖拽源，使其可以被拖拽到画布上。
 *
 * @param {HTMLElement} elt - 要创建拖拽源的DOM元素
 * @param {Function} dropHandler - 拖拽释放处理器函数
 * @param {HTMLElement} preview - 拖拽预览元素
 * @param {Array} cells - 要拖拽的单元格数组
 * @param {mxRectangle} bounds - 边界矩形
 * @returns {mxDragSource} 创建的拖拽源对象
 */
Sidebar.prototype.createDragSource = function (elt, dropHandler, preview, cells, bounds) {
  // 检查单元格是否包含任何顶点
  var ui = this.editorUi;
  var graph = ui.editor ? ui.editor.graph : window.myEditor.editor.graph;
  var freeSourceEdge = null;
  var firstVertex = null;
  var sidebar = this;

  for (var i = 0; i < cells.length; i++) {
    if (firstVertex == null && graph.model.isVertex(cells[i])) {
      firstVertex = i;
    } else if (freeSourceEdge == null && graph.model.isEdge(cells[i]) &&
      graph.model.getTerminal(cells[i], true) == null) {
      freeSourceEdge = i;
    }

    if (firstVertex != null && freeSourceEdge != null) {
      break;
    }
  }

  var dropStyleEnabled = this.isDropStyleEnabled(cells, firstVertex);

  var dragSource = mxUtils.makeDraggable(elt, graph, mxUtils.bind(this, function (graph, evt, target, x, y) {
    if (this.updateThread != null) {
      window.clearTimeout(this.updateThread);
    }

    if (cells != null && currentStyleTarget != null && activeArrow == styleTarget) {
      var tmp = graph.isCellSelected(currentStyleTarget.cell) ? graph.getSelectionCells() : [currentStyleTarget.cell];
      var updatedCells = this.updateShapes((graph.model.isEdge(currentStyleTarget.cell)) ? cells[0] : cells[firstVertex], tmp);
      graph.setSelectionCells(updatedCells);
    } else if (cells != null && activeArrow != null && currentTargetState != null && activeArrow != styleTarget) {
      var index = (graph.model.isEdge(currentTargetState.cell) || freeSourceEdge == null) ? firstVertex : freeSourceEdge;
      graph.setSelectionCells(this.dropAndConnect(currentTargetState.cell, cells, direction, index, evt));
    } else {
      dropHandler.apply(this, arguments);
    }

    if (this.editorUi.hoverIcons != null) {
      this.editorUi.hoverIcons.update(graph.view.getState(graph.getSelectionCell()));
    }
  }), preview, 0, 0, graph.autoscroll, true, true, undefined, cells);

  // 如果按下取消键则停止拖拽
  graph.addListener(mxEvent.ESCAPE, function (sender, evt) {
    if (dragSource.isActive()) {
      dragSource.reset();
    }
  });

  // 重写mouseDown以忽略弹出触发器
  var mouseDown = dragSource.mouseDown;

  dragSource.mouseDown = function (evt) {
    if (!mxEvent.isPopupTrigger(evt) && !mxEvent.isMultiTouchEvent(evt)) {
      graph = ui.editor ? ui.editor.graph : window.myEditor.editor.graph
      graph.stopEditing();
      mouseDown.apply(this, [...arguments, cells]);
    }
  };

  // 通过图片标签在怪异模式和IE8中进行事件重定向的解决方法
  function createArrow(img, tooltip) {
    var arrow = null;
    arrow = mxUtils.createImage(img.src);
    arrow.style.width = img.width + 'px';
    arrow.style.height = img.height + 'px';

    if (tooltip != null) {
      arrow.setAttribute('title', tooltip);
    }

    mxUtils.setOpacity(arrow, (img == this.refreshTarget) ? 30 : 20);
    arrow.style.position = 'absolute';
    arrow.style.cursor = 'crosshair';

    return arrow;
  };

  var currentTargetState = null;
  var currentStateHandle = null;
  var currentStyleTarget = null;
  var activeTarget = false;

  var arrowUp = createArrow(this.triangleUp, mxResources.get('connect'));
  var arrowRight = createArrow(this.triangleRight, mxResources.get('connect'));
  var arrowDown = createArrow(this.triangleDown, mxResources.get('connect'));
  var arrowLeft = createArrow(this.triangleLeft, mxResources.get('connect'));
  var styleTarget = createArrow(this.refreshTarget, mxResources.get('replace'));
  // 旧版IE中实际parentNode未更新的解决方法
  var styleTargetParent = null;
  var roundSource = createArrow(this.roundDrop);
  var roundTarget = createArrow(this.roundDrop);
  var direction = mxConstants.DIRECTION_NORTH;
  var activeArrow = null;

  function checkArrow(x, y, bounds, arrow) {
    if (arrow.parentNode != null) {
      if (mxUtils.contains(bounds, x, y)) {
        mxUtils.setOpacity(arrow, 100);
        activeArrow = arrow;
      } else {
        mxUtils.setOpacity(arrow, (arrow == styleTarget) ? 30 : 20);
      }
    }

    return bounds;
  };

  // 如果目标处于活动状态则隐藏辅助线和预览
  var dsCreatePreviewElement = dragSource.createPreviewElement;

  // 存储预览元素的初始大小
  dragSource.createPreviewElement = function (graph) {
    var elt = dsCreatePreviewElement.apply(this, arguments);

    // 替换形状时工具提示需要的事件透传
    if (mxClient.IS_SVG) {
      elt.style.pointerEvents = 'none';
    }

    this.previewElementWidth = elt.style.width;
    this.previewElementHeight = elt.style.height;

    return elt;
  };

  // 显示/隐藏悬停图标
  var dragEnter = dragSource.dragEnter;
  dragSource.dragEnter = function (graph, evt) {
    if (ui.hoverIcons != null) {
      ui.hoverIcons.setDisplay('none');
    }

    dragEnter.apply(this, arguments);
  };

  var dragExit = dragSource.dragExit;
  dragSource.dragExit = function (graph, evt) {
    if (ui.hoverIcons != null) {
      ui.hoverIcons.setDisplay('');
    }

    dragExit.apply(this, arguments);
  };

  dragSource.dragOver = function (graph, evt) {
    mxDragSource.prototype.dragOver.apply(this, arguments);

    if (this.currentGuide != null && activeArrow != null) {
      this.currentGuide.hide();
    }

    if (this.previewElement != null) {
      var view = graph.view;

      if (currentStyleTarget != null && activeArrow == styleTarget) {
        this.previewElement.style.display = (graph.model.isEdge(currentStyleTarget.cell)) ? 'none' : '';

        this.previewElement.style.left = currentStyleTarget.x + 'px';
        this.previewElement.style.top = currentStyleTarget.y + 'px';
        this.previewElement.style.width = currentStyleTarget.width + 'px';
        this.previewElement.style.height = currentStyleTarget.height + 'px';
      } else if (currentTargetState != null && activeArrow != null) {
        if (dragSource.currentHighlight != null && dragSource.currentHighlight.state != null) {
          dragSource.currentHighlight.hide();
        }

        var index = (graph.model.isEdge(currentTargetState.cell) || freeSourceEdge == null) ? firstVertex : freeSourceEdge;
        var geo = sidebar.getDropAndConnectGeometry(currentTargetState.cell, cells[index], direction, cells);
        var geo2 = (!graph.model.isEdge(currentTargetState.cell)) ? graph.getCellGeometry(currentTargetState.cell) : null;
        var geo3 = graph.getCellGeometry(cells[index]);
        var parent = graph.model.getParent(currentTargetState.cell);
        var dx = view.translate.x * view.scale;
        var dy = view.translate.y * view.scale;

        if (geo2 != null && !geo2.relative && graph.model.isVertex(parent) && parent != view.currentRoot) {
          var pState = view.getState(parent);

          dx = pState.x;
          dy = pState.y;
        }

        var dx2 = geo3.x;
        var dy2 = geo3.y;

        // 忽略边的几何信息
        if (graph.model.isEdge(cells[index])) {
          dx2 = 0;
          dy2 = 0;
        }

        // 在拖拽位置显示预览
        this.previewElement.style.left = ((geo.x - dx2) * view.scale + dx) + 'px';
        this.previewElement.style.top = ((geo.y - dy2) * view.scale + dy) + 'px';

        if (cells.length == 1) {
          this.previewElement.style.width = (geo.width * view.scale) + 'px';
          this.previewElement.style.height = (geo.height * view.scale) + 'px';
        }

        this.previewElement.style.display = '';
      } else if (dragSource.currentHighlight && dragSource.currentHighlight.state != null &&
        graph.model.isEdge(dragSource.currentHighlight.state.cell)) {
        // 分割边时居中拖拽单元格
        this.previewElement.style.left = Math.round(parseInt(this.previewElement.style.left) -
          bounds.width * view.scale / 2) + 'px';
        this.previewElement.style.top = Math.round(parseInt(this.previewElement.style.top) -
          bounds.height * view.scale / 2) + 'px';
      } else {
        this.previewElement.style.width = this.previewElementWidth;
        this.previewElement.style.height = this.previewElementHeight;
        this.previewElement.style.display = '';
      }
    }
  };

  var startTime = new Date().getTime();
  var timeOnTarget = 0;
  var prev = null;

  // 获取源单元格样式以便在下面比较形状
  var sourceCellStyle = this.graph.getCellStyle(cells[0]);

  // 仅在目标是有效的根时才允许拖拽到单元格中
  dragSource.getDropTarget = mxUtils.bind(this, function (graph, x, y, evt) {
    this.graph = this.graph ? this.graph : graph
    // Alt键表示完全没有目标
    // 稍后: 在结果将要去的地方显示预览
    var cell = (!mxEvent.isAltDown(evt) && cells != null) ?
      graph.getCellAt(x, y, null, null, null, function (state, x, y) {
        return graph.isContainer(state.cell);
      }) : null;

    // 如果存在可连接的父级顶点则使用它
    if (cell != null && !this.graph.isCellConnectable(cell) &&
      !this.graph.model.isEdge(cell)) {
      var parent = this.graph.getModel().getParent(cell);

      if (this.graph.getModel().isVertex(parent) &&
        this.graph.isCellConnectable(parent)) {
        cell = parent;
      }
    }

    // 忽略锁定的单元格
    if (graph.isCellLocked(cell)) {
      cell = null;
    }

    var state = graph.view.getState(cell);
    activeArrow = null;
    var bbox = null;

    // 在目标上的时间
    if (prev != state) {
      startTime = new Date().getTime();
      timeOnTarget = 0;
      prev = state;

      if (this.updateThread != null) {
        window.clearTimeout(this.updateThread);
      }

      if (state != null) {
        this.updateThread = window.setTimeout(function () {
          if (activeArrow == null) {
            prev = state;
            dragSource.getDropTarget(graph, x, y, evt);
          }
        }, this.dropTargetDelay + 10);
      }
    } else {
      timeOnTarget = new Date().getTime() - startTime;
    }

    // Shift键表示禁用，对有子项的单元格延迟显示，在this.dropTargetDelay后显示，2500ms后隐藏
    if (dropStyleEnabled && (timeOnTarget < 2500) && state != null && !mxEvent.isShiftDown(evt) &&
      // 如果形状相等或目标没有描边、填充和渐变则使用更长的延迟，除了图片
      (((mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE) != mxUtils.getValue(sourceCellStyle, mxConstants.STYLE_SHAPE) &&
            (mxUtils.getValue(state.style, mxConstants.STYLE_STROKECOLOR, mxConstants.NONE) != mxConstants.NONE ||
              mxUtils.getValue(state.style, mxConstants.STYLE_FILLCOLOR, mxConstants.NONE) != mxConstants.NONE ||
              mxUtils.getValue(state.style, mxConstants.STYLE_GRADIENTCOLOR, mxConstants.NONE) != mxConstants.NONE)) ||
          mxUtils.getValue(sourceCellStyle, mxConstants.STYLE_SHAPE) == 'image') ||
        timeOnTarget > 1500 || graph.model.isEdge(state.cell)) && (timeOnTarget > this.dropTargetDelay) &&
      !this.isDropStyleTargetIgnored(state) && ((graph.model.isVertex(state.cell) && firstVertex != null) ||
        (graph.model.isEdge(state.cell) && graph.model.isEdge(cells[0])))) {
      currentStyleTarget = state;
      var tmp = (graph.model.isEdge(state.cell)) ? graph.view.getPoint(state) :
        new mxPoint(state.getCenterX(), state.getCenterY());
      tmp = new mxRectangle(tmp.x - this.refreshTarget.width / 2, tmp.y - this.refreshTarget.height / 2,
        this.refreshTarget.width, this.refreshTarget.height);

      styleTarget.style.left = Math.floor(tmp.x) + 'px';
      styleTarget.style.top = Math.floor(tmp.y) + 'px';

      if (styleTargetParent == null) {
        // graph.container.appendChild(styleTarget);
        styleTargetParent = styleTarget.parentNode;
      }

      checkArrow(x, y, tmp, styleTarget);
    }
    // 在被忽略的边上不重置
    else if (currentStyleTarget == null || !mxUtils.contains(currentStyleTarget, x, y) ||
      (timeOnTarget > 1500 && !mxEvent.isShiftDown(evt))) {
      currentStyleTarget = null;

      if (styleTargetParent != null) {
        styleTarget.parentNode.removeChild(styleTarget);
        styleTargetParent = null;
      }
    } else if (currentStyleTarget != null && styleTargetParent != null) {
      // 作为副作用设置活动箭头
      var tmp = (graph.model.isEdge(currentStyleTarget.cell)) ? graph.view.getPoint(currentStyleTarget) : new mxPoint(currentStyleTarget.getCenterX(), currentStyleTarget.getCenterY());
      tmp = new mxRectangle(tmp.x - this.refreshTarget.width / 2, tmp.y - this.refreshTarget.height / 2,
        this.refreshTarget.width, this.refreshTarget.height);
      checkArrow(x, y, tmp, styleTarget);
    }

    // 检查是否在边界内
    if (activeTarget && currentTargetState != null && !mxEvent.isAltDown(evt) && activeArrow == null) {
      // 稍后: 为边使用命中检测
      bbox = mxRectangle.fromRectangle(currentTargetState);

      if (graph.model.isEdge(currentTargetState.cell)) {
        var pts = currentTargetState.absolutePoints;

        if (roundSource.parentNode != null) {
          var p0 = pts[0];
          bbox.add(checkArrow(x, y, new mxRectangle(p0.x - this.roundDrop.width / 2,
            p0.y - this.roundDrop.height / 2, this.roundDrop.width, this.roundDrop.height), roundSource));
        }

        if (roundTarget.parentNode != null) {
          var pe = pts[pts.length - 1];
          bbox.add(checkArrow(x, y, new mxRectangle(pe.x - this.roundDrop.width / 2,
            pe.y - this.roundDrop.height / 2,
            this.roundDrop.width, this.roundDrop.height), roundTarget));
        }
      } else {
        var bds = mxRectangle.fromRectangle(currentTargetState);

        // 使用外部边界框来考虑旋转
        if (currentTargetState.shape != null && currentTargetState.shape.boundingBox != null) {
          bds = mxRectangle.fromRectangle(currentTargetState.shape.boundingBox);
        }

        bds.grow(this.graph.tolerance);
        bds.grow(HoverIcons.prototype.arrowSpacing);

        var handler = this.graph.selectionCellsHandler.getHandler(currentTargetState.cell);

        if (handler != null) {
          bds.x -= handler.horizontalOffset / 2;
          bds.y -= handler.verticalOffset / 2;
          bds.width += handler.horizontalOffset;
          bds.height += handler.verticalOffset;

          // 添加旋转手柄的边界框以避免重叠
          if (handler.rotationShape != null && handler.rotationShape.node != null &&
            handler.rotationShape.node.style.visibility != 'hidden' &&
            handler.rotationShape.node.style.display != 'none' &&
            handler.rotationShape.boundingBox != null) {
            bds.add(handler.rotationShape.boundingBox);
          }
        }

        bbox.add(checkArrow(x, y, new mxRectangle(currentTargetState.getCenterX() - this.triangleUp.width / 2,
          bds.y - this.triangleUp.height, this.triangleUp.width, this.triangleUp.height), arrowUp));
        bbox.add(checkArrow(x, y, new mxRectangle(bds.x + bds.width,
          currentTargetState.getCenterY() - this.triangleRight.height / 2,
          this.triangleRight.width, this.triangleRight.height), arrowRight));
        bbox.add(checkArrow(x, y, new mxRectangle(currentTargetState.getCenterX() - this.triangleDown.width / 2,
          bds.y + bds.height, this.triangleDown.width, this.triangleDown.height), arrowDown));
        bbox.add(checkArrow(x, y, new mxRectangle(bds.x - this.triangleLeft.width,
          currentTargetState.getCenterY() - this.triangleLeft.height / 2,
          this.triangleLeft.width, this.triangleLeft.height), arrowLeft));
      }

      // 添加容差
      if (bbox != null) {
        bbox.grow(10);
      }
    }

    direction = mxConstants.DIRECTION_NORTH;

    if (activeArrow == arrowRight) {
      direction = mxConstants.DIRECTION_EAST;
    } else if (activeArrow == arrowDown || activeArrow == roundTarget) {
      direction = mxConstants.DIRECTION_SOUTH;
    } else if (activeArrow == arrowLeft) {
      direction = mxConstants.DIRECTION_WEST;
    }

    if (currentStyleTarget != null && activeArrow == styleTarget) {
      state = currentStyleTarget;
    }

    var validTarget = (firstVertex == null || graph.isCellConnectable(cells[firstVertex])) &&
      ((graph.model.isEdge(cell) && firstVertex != null) ||
        (graph.model.isVertex(cell) && graph.isCellConnectable(cell)));

    // 拖拽箭头在this.dropTargetDelay后显示，5秒后隐藏，500ms后切换箭头
    if ((currentTargetState != null && timeOnTarget >= 5000) ||
      (currentTargetState != state &&
        (bbox == null || !mxUtils.contains(bbox, x, y) ||
          (timeOnTarget > 500 && activeArrow == null && validTarget)))) {
      activeTarget = false;
      currentTargetState = ((timeOnTarget < 5000 && timeOnTarget > this.dropTargetDelay) ||
        graph.model.isEdge(cell)) ? state : null;

      if (currentTargetState != null && validTarget) {
        var elts = [roundSource, roundTarget, arrowUp, arrowRight, arrowDown, arrowLeft];

        for (var i = 0; i < elts.length; i++) {
          if (elts[i].parentNode != null) {
            elts[i].parentNode.removeChild(elts[i]);
          }
        }

        if (graph.model.isEdge(cell)) {
          var pts = state.absolutePoints;

          if (pts != null) {
            var p0 = pts[0];
            var pe = pts[pts.length - 1];
            var tol = graph.tolerance;
            var box = new mxRectangle(x - tol, y - tol, 2 * tol, 2 * tol);

            roundSource.style.left = Math.floor(p0.x - this.roundDrop.width / 2) + 'px';
            roundSource.style.top = Math.floor(p0.y - this.roundDrop.height / 2) + 'px';

            roundTarget.style.left = Math.floor(pe.x - this.roundDrop.width / 2) + 'px';
            roundTarget.style.top = Math.floor(pe.y - this.roundDrop.height / 2) + 'px';

            if (graph.model.getTerminal(cell, true) == null) {
              graph.container.appendChild(roundSource);
            }

            if (graph.model.getTerminal(cell, false) == null) {
              graph.container.appendChild(roundTarget);
            }
          }
        } else {
          var bds = mxRectangle.fromRectangle(state);

          // 使用外部边界框来考虑旋转
          if (state.shape != null && state.shape.boundingBox != null) {
            bds = mxRectangle.fromRectangle(state.shape.boundingBox);
          }

          bds.grow(this.graph.tolerance);
          bds.grow(HoverIcons.prototype.arrowSpacing);

          var handler = this.graph.selectionCellsHandler.getHandler(state.cell);

          if (handler != null) {
            bds.x -= handler.horizontalOffset / 2;
            bds.y -= handler.verticalOffset / 2;
            bds.width += handler.horizontalOffset;
            bds.height += handler.verticalOffset;

            // 添加旋转手柄的边界框以避免重叠
            if (handler.rotationShape != null && handler.rotationShape.node != null &&
              handler.rotationShape.node.style.visibility != 'hidden' &&
              handler.rotationShape.node.style.display != 'none' &&
              handler.rotationShape.boundingBox != null) {
              bds.add(handler.rotationShape.boundingBox);
            }
          }

          arrowUp.style.left = Math.floor(state.getCenterX() - this.triangleUp.width / 2) + 'px';
          arrowUp.style.top = Math.floor(bds.y - this.triangleUp.height) + 'px';

          arrowRight.style.left = Math.floor(bds.x + bds.width) + 'px';
          arrowRight.style.top = Math.floor(state.getCenterY() - this.triangleRight.height / 2) + 'px';

          arrowDown.style.left = arrowUp.style.left
          arrowDown.style.top = Math.floor(bds.y + bds.height) + 'px';

          arrowLeft.style.left = Math.floor(bds.x - this.triangleLeft.width) + 'px';
          arrowLeft.style.top = arrowRight.style.top;

          if (state.style['portConstraint'] != 'eastwest') {
            graph.container.appendChild(arrowUp);
            graph.container.appendChild(arrowDown);
          }

          graph.container.appendChild(arrowRight);
          graph.container.appendChild(arrowLeft);
        }

        // 隐藏鼠标下单元格的手柄
        if (state != null) {
          currentStateHandle = graph.selectionCellsHandler.getHandler(state.cell);

          if (currentStateHandle != null && currentStateHandle.setHandlesVisible != null) {
            currentStateHandle.setHandlesVisible(false);
          }
        }

        activeTarget = true;
      } else {
        var elts = [roundSource, roundTarget, arrowUp, arrowRight, arrowDown, arrowLeft];

        for (var i = 0; i < elts.length; i++) {
          if (elts[i].parentNode != null) {
            elts[i].parentNode.removeChild(elts[i]);
          }
        }
      }
    }

    if (!activeTarget && currentStateHandle != null) {
      currentStateHandle.setHandlesVisible(true);
    }

    // 处理拖拽目标
    var target = ((!mxEvent.isAltDown(evt) || mxEvent.isShiftDown(evt)) &&
        !(currentStyleTarget != null && activeArrow == styleTarget)) ?
      mxDragSource.prototype.getDropTarget.apply(this, arguments) : null;
    var model = graph.getModel();

    if (target != null) {
      if (activeArrow != null || !graph.isSplitTarget(target, cells, evt)) {
        // 选择父级组作为拖拽目标
        while (target != null && !graph.isValidDropTarget(target, cells, evt) &&
          model.isVertex(model.getParent(target))) {
          target = model.getParent(target);
        }

        if (target != null && (graph.view.currentRoot == target ||
            (!graph.isValidRoot(target) &&
              graph.getModel().getChildCount(target) == 0) ||
            graph.isCellLocked(target) || model.isEdge(target) ||
            !graph.isValidDropTarget(target, cells, evt))) {
          target = null;
        }
      }
    }

    return target;
  });

  dragSource.stopDrag = function () {
    mxDragSource.prototype.stopDrag.apply(this, arguments);

    var elts = [roundSource, roundTarget, styleTarget, arrowUp, arrowRight, arrowDown, arrowLeft];

    for (var i = 0; i < elts.length; i++) {
      if (elts[i].parentNode != null) {
        elts[i].parentNode.removeChild(elts[i]);
      }
    }

    if (currentTargetState != null && currentStateHandle != null) {
      currentStateHandle.reset();
    }

    currentStateHandle = null;
    currentTargetState = null;
    currentStyleTarget = null;
    styleTargetParent = null;
    activeArrow = null;
  };

  return dragSource;
};

/**
 * Adds a handler for inserting the cell with a single click.
 */
Sidebar.prototype.itemClicked = async function (cells, ds, evt, elt) {
  console.log('itemClicked');
  var graph = this.editorUi.editor.graph;
  graph.container.focus();

  // 关系线不创建  端口不默认拖动
  if ("relation" == cells[0].value.nodeName ||
    ("entity" == cells[0].value.nodeName && ("SYSML_BLOCKDEFINITION_WANZHENGPORTJIEDIAN" == cells[0].getAttribute('display') || "SYSML_BLOCKDEFINITION_DAILIPORTJIEDIAN" == cells[0].getAttribute('display')))) {
    $(".geItem").each(function () {
      $(this).css("background", "");
    });
    $(ds.element).css("background", "#ddd");
    window.edgeValue = cells[0].value;
    window.mxConnectioCell = cells[0];
    return;
  }

  // Alt+点击插入并连接
  if (mxEvent.isAltDown(evt) && graph.getSelectionCount() == 1 &&
    graph.model.isVertex(graph.getSelectionCell())) {
    var firstVertex = null;

    for (var i = 0; i < cells.length && firstVertex == null; i++) {
      if (graph.model.isVertex(cells[i])) {
        firstVertex = i;
      }
    }

    if (firstVertex != null) {
      graph.setSelectionCells(this.dropAndConnect(graph.getSelectionCell(), cells,
        (mxEvent.isMetaDown(evt) || mxEvent.isControlDown(evt)) ?
        (mxEvent.isShiftDown(evt) ? mxConstants.DIRECTION_WEST : mxConstants.DIRECTION_NORTH) :
        (mxEvent.isShiftDown(evt) ? mxConstants.DIRECTION_EAST : mxConstants.DIRECTION_SOUTH),
        firstVertex, evt));
      graph.scrollCellToVisible(graph.getSelectionCell());
    }
  }
  // Shift+点击更新形状
  else if (mxEvent.isShiftDown(evt) && !graph.isSelectionEmpty()) {
    this.updateShapes(cells[0], graph.getSelectionCells());
    graph.scrollCellToVisible(graph.getSelectionCell());
  } else {
    // var pt = (mxEvent.isAltDown(evt)) ? graph.getFreeInsertPoint() :
    //     graph.getCenterInsertPoint(graph.getBoundingBoxFromGeometry(cells, true));
    var pt = graph.getFreeInsertPoint();
    if (cells[0].value && cells[0].value.nodeName == "timeaxis") {
      pt.y = 400;
    }
    if (mxEvent.CLICK && typeof (cells[0].getValue()) == 'object' && cells[0].getValue().getAttribute('display') === 'LABEL_LICHENGBEI') {
      window.click = true;
      console.log("window.click", window.click);
    }

    function getX() {
      let maxX = -99999
      for (let key in myEditor.editor.graph.model.cells) {
        const value = myEditor.editor.graph.model.cells[key]
        if (value.id !== '3' && value.geometry) {
          const w = value.geometry.x + value.geometry.width
          maxX = maxX > w ? maxX : w
        }
      }
      if (typeof maxX !== 'number') {
        return 0
      }
      if (maxX === 0) {
        return myEditor.editor.graph.backgroundPage.geometry.x + 20
      }
      return maxX + 20
    }

    ds.drop(graph, evt, null, getX(), pt.y + 30, true);
    // 修改对象
    let res = await getObjectLabelByCell(myEditor.editor.graph.getSelectionCell(), 0)
    if (res === undefined) return
    let util = new utils()
    await util.putLabel(myEditor.editor.graph.getSelectionCell(), res, resolveCell(myEditor.editor.graph.getSelectionCell()))
  }
};

/**
 * 动态设置鼠标图标
 */
Sidebar.prototype.setGraphCursor = function (cell) {
  // D:\项目\203\KD-WEB-VUE-BUSINESS\src\assets\img\jxz_icon.png
  const graphContainer = document.getElementById('geDiagramContainer')
  graphContainer.style.cursor = 'url(img/icon/object/选择.svg)'
}

/**
 * 最后点击的侧边栏元素。
 * 用于跟踪用户最后点击的侧边栏项目，便于状态管理和样式更新。
 */
Sidebar.prototype.lastClickElt = null

/**
 * 替换样式字符串中的空值。
 * 将样式字符串中的undefined值替换为空字符串，确保样式格式正确。
 *
 * @param {string} style - 要处理的样式字符串
 * @returns {string} 处理后的样式字符串
 */
const resetNullStyle = function (style) {
  return style.replace(/=undefined;/g, ';');
};

/**
 * 添加单击插入单元格的处理器。
 * 为侧边栏元素添加鼠标事件处理器，支持单击选择和拖拽插入功能。
 *
 * @param {HTMLElement} elt - 侧边栏元素
 * @param {Object} ds - 拖拽源对象
 * @param {Array} cells - 要插入的单元格数组
 */
Sidebar.prototype.addClickHandler = function (elt, ds, cells) {
  // 树引用节点只能拖拽，不能点击
  if (cells[0] && cells[0].value instanceof Object && cells[0].value.getAttribute("selectQuote") === 'false') return false

  var graph = this.editorUi.editor.graph;
  var oldMouseDown = ds.mouseDown;
  var oldMouseMove = ds.mouseMove;
  var oldMouseUp = ds.mouseUp;
  var tol = graph.tolerance;
  var first = null;
  var sb = this;
  let currentPoint = null

  ds.mouseDown = function (evt) {
    graph.selectingCell = cells[0]
    window.isAddingStatus = true
    sb.__proto__.lastClickElt && (sb.__proto__.lastClickElt.style.backgroundColor = '#fff')
    elt.style.backgroundColor = '#eee'
    sb.__proto__.lastClickElt = elt
    sb.updateToolStatus()
    sb.setGraphCursor(cells[0])
    console.log('选择了元素');
    return
    oldMouseDown.apply(this, arguments);
    first = new mxPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt));
    if (this.dragElement != null) {
      this.dragElement.style.display = 'none';
      mxUtils.setOpacity(elt, 50);
    }
  };

  ds.mouseMove = function (evt) {
    console.log('mouseMove');
    if (this.dragElement != null && this.dragElement.style.display == 'none' &&
      first != null && (Math.abs(first.x - mxEvent.getClientX(evt)) > tol ||
        Math.abs(first.y - mxEvent.getClientY(evt)) > tol)) {
      this.dragElement.style.display = '';
      mxUtils.setOpacity(elt, 100);
    }
    currentPoint = oldMouseMove.apply(this, arguments);
  };

  ds.mouseUp = function (evt) {
    try {
      if (!mxEvent.isPopupTrigger(evt) && this.currentGraph == null &&
        this.dragElement != null && this.dragElement.style.display == 'none') {
        console.log('mouseUp');
        sb.itemClicked(cells, ds, evt, elt);
      }
      oldMouseUp.apply(ds, arguments);
      mxUtils.setOpacity(elt, 100);
      first = null;
      // 单次点击后在此元素上阻止工具提示
      sb.currentElt = elt;
    } catch (e) {
      ds.reset();
      sb.editorUi.handleError(e);
    }
  };
};

/**
 * 创建数据定义的序列图模板。
 * 根据指定的样式和参数创建序列图元素的模板条目。
 *
 * @param {string} style - 元素样式
 * @param {number} width - 元素宽度
 * @param {number} height - 元素高度
 * @param {Object} value - 元素值
 * @param {string} title - 元素标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} showTitle - 是否显示标题
 * @param {string} tags - 搜索标签
 * @param {string} objType - 对象类型
 * @returns {Object} 创建的模板条目
 */
Sidebar.prototype.createSequence = function (style, width, height, value, title, showLabel, showTitle, tags, objType) {
  var cells = [new mxCell((value != null) ? value : '', new mxGeometry(0, 0, width, height), style, objType)];
  cells[0].vertex = true;

  tags = (tags != null && tags.length > 0) ? tags : ((title != null) ? title.toLowerCase() : '');
  return this.addEntry(tags, mxUtils.bind(this, function () {
    return this.createItem(cells, title, showLabel, showTitle, width, height, allowCellsInserted);
  }));
}

/**
 * 创建顶点模板条目。
 * 为给定的参数创建一个顶点模板条目，并添加到搜索索引中。
 *
 * @param {string} style - 顶点样式
 * @param {number} width - 顶点宽度
 * @param {number} height - 顶点高度
 * @param {Object} value - 顶点值
 * @param {string} title - 模板标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} showTitle - 是否显示标题
 * @param {string} tags - 搜索标签
 * @param {string} objType - 对象类型
 * @returns {Object} 创建的模板条目
 */
Sidebar.prototype.createVertexTemplateEntry = function (style, width, height, value, title, showLabel, showTitle, tags, objType) {
  tags = (tags != null && tags.length > 0) ? tags : ((title != null) ? title.toLowerCase() : '');
  return this.addEntry(tags, mxUtils.bind(this, function () {
    return this.createVertexTemplate(style, width, height, value, title, showLabel, showTitle, null, objType);
  }));
}

/**
 * 创建顶点模板。
 * 根据指定的样式、尺寸和值创建可拖拽的顶点模板，用于在画布中插入新的顶点元素。
 *
 * @param {string} style - 顶点的样式字符串
 * @param {number} width - 模板的宽度
 * @param {number} height - 模板的高度
 * @param {Object} value - 顶点的值
 * @param {string} title - 模板的标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} showTitle - 是否显示标题
 * @param {boolean} allowCellsInserted - 是否允许插入单元格
 * @param {string} objType - 对象类型
 * @returns {Object} 创建的顶点模板
 */
Sidebar.prototype.createVertexTemplate = function (style, width, height, value, title, showLabel, showTitle, allowCellsInserted, objType) {
  var cells = [new mxCell((value != null) ? value : '', new mxGeometry(0, 0, width, height), style, objType)];
  cells[0].vertex = true;
  return this.createVertexTemplateFromCells(cells, width, height, title, showLabel, showTitle, allowCellsInserted);
};

/**
 * 从数据创建顶点模板。
 * 根据压缩的XML数据创建顶点模板，用于从存储的数据恢复图形元素。
 *
 * @param {string} data - 压缩的XML数据字符串
 * @param {number} width - 模板的宽度
 * @param {number} height - 模板的高度
 * @param {string} title - 模板的标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} showTitle - 是否显示标题
 * @param {boolean} allowCellsInserted - 是否允许插入单元格
 * @returns {Object} 从数据创建的顶点模板
 */
Sidebar.prototype.createVertexTemplateFromData = function (data, width, height, title, showLabel, showTitle, allowCellsInserted) {
  var doc = mxUtils.parseXml(Graph.decompress(data));
  var codec = new mxCodec(doc);

  var model = new mxGraphModel();
  codec.decode(doc.documentElement, model);

  var cells = this.graph.cloneCells(model.root.getChildAt(0).children);

  return this.createVertexTemplateFromCells(cells, width, height, title, showLabel, showTitle, allowCellsInserted);
};

/**
 * 从单元格创建顶点模板。
 * 根据现有的单元格数组创建可拖拽的顶点模板，用于在画布中插入图形元素。
 *
 * @param {Array} cells - 要转换为模板的单元格数组
 * @param {number} width - 模板的宽度
 * @param {number} height - 模板的高度
 * @param {string} title - 模板的标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} showTitle - 是否显示标题
 * @param {boolean} allowCellsInserted - 是否允许插入单元格
 * @returns {Object} 从单元格创建的顶点模板
 */
Sidebar.prototype.createVertexTemplateFromCells = function (cells, width, height, title, showLabel, showTitle, allowCellsInserted) {
  // 使用此行代码可以将调用此函数的代码转换为包含大量样板代码的单元格创建代码
  //console.trace('xml', Graph.compress(mxUtils.getXml(this.graph.encodeCells(cells))), cells);
  return this.createItem(cells, title, showLabel, showTitle, width, height, allowCellsInserted);
};

/**
 * 创建边模板条目。
 * 为给定的参数创建一个边模板条目，并添加到搜索索引中。
 *
 * @param {string} style - 边的样式
 * @param {number} width - 边的宽度
 * @param {number} height - 边的高度
 * @param {Object} value - 边的值
 * @param {string} title - 模板标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {string} tags - 搜索标签
 * @param {boolean} allowCellsInserted - 是否允许插入单元格
 * @returns {Object} 创建的边模板条目
 */
Sidebar.prototype.createEdgeTemplateEntry = function (style, width, height, value, title, showLabel, tags, allowCellsInserted) {
  tags = (tags != null && tags.length > 0) ? tags : title.toLowerCase();

  return this.addEntry(tags, mxUtils.bind(this, function () {
    return this.createEdgeTemplate(style, width, height, value, title, showLabel, allowCellsInserted);
  }));
};

/**
 * 创建边模板。
 * 根据指定的样式和尺寸创建可拖拽的边模板，用于在画布中插入新的边元素。
 *
 * @param {string} style - 边的样式字符串
 * @param {number} width - 模板的宽度
 * @param {number} height - 模板的高度
 * @param {Object} value - 边的值
 * @param {string} title - 模板的标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} allowCellsInserted - 是否允许插入单元格
 * @returns {Object} 创建的边模板
 */
Sidebar.prototype.createEdgeTemplate = function (style, width, height, value, title, showLabel, allowCellsInserted) {

  var cell = new mxCell((value != null) ? value : '', new mxGeometry(0, 0, width, height), style);
  cell.geometry.setTerminalPoint(new mxPoint(0, height), true);
  cell.geometry.setTerminalPoint(new mxPoint(width, 0), false);
  cell.geometry.relative = true;
  cell.edge = true;

  return this.createEdgeTemplateFromCells([cell], width, height, title, showLabel, allowCellsInserted);
};

/**
 * 从单元格创建边模板。
 * 根据现有的单元格数组创建可拖拽的边模板，用于在画布中插入边元素。
 *
 * @param {Array} cells - 要转换为边模板的单元格数组
 * @param {number} width - 模板的宽度
 * @param {number} height - 模板的高度
 * @param {string} title - 模板的标题
 * @param {boolean} showLabel - 是否显示标签
 * @param {boolean} allowCellsInserted - 是否允许插入单元格
 * @returns {Object} 从单元格创建的边模板
 */
Sidebar.prototype.createEdgeTemplateFromCells = function (cells, width, height, title, showLabel, allowCellsInserted) {
  return this.createItem(cells, title, showLabel, true, width, height, allowCellsInserted);
};

/**
 * 添加指定的调色板函数集合。
 * 将一组函数添加到调色板中，每个函数负责创建一个侧边栏项目。
 *
 * @param {string} id - 调色板的唯一标识符
 * @param {string} title - 调色板的标题
 * @param {boolean} expanded - 是否初始展开调色板
 * @param {Array} fns - 创建调色板项目的函数数组
 */
Sidebar.prototype.addPaletteFunctions = function (id, title, expanded, fns) {
  this.addPalette(id, title, expanded, mxUtils.bind(this, function (content) {
    for (var i = 0; i < fns.length; i++) {
      content.appendChild(fns[i](content), title);
    }
  }));
};

/**
 * 添加数据定义调色板函数。
 * 通过AJAX加载数据定义类型的实体数据，为每个实体创建对应的调色板项目。
 *
 * @param {Object} entity - 实体对象，包含objectNameEn、objectName、viewId等属性
 * @param {boolean} expanded - 是否初始展开调色板
 */
Sidebar.prototype.addDataDefinitionPaletteFunctions = function (entity, expanded) {

  const id = "div_dataDefinition_" + entity.objectNameEn;
  const title = "[数据定义] - " + entity.objectName;
  const viewId = entity.viewId;
  const objectType = entity.objectType.name;
  const objectId = entity.objectId;
  const projectId = window.projectId; // object_graph_main.html 页面上定义

  this.addPalette(id, title, expanded, mxUtils.bind(this, async function (content) {
    // console.log(entity);
    // console.log(content);
    // alert(objectType);
    const data = [];
    const fns = [];
    await window.$axios.get(contextPath + "/difine/entitydata", {
      params: {
        viewId: viewId,
        objectId: objectId,
        projectId: projectId
      }
    }).then((responseText) => {
      if (responseText && responseText.statusCode === 200) {
        $.each(responseText.rows, function (index, row) {
          data.push(row);
        });
      }
    }).catch(e => {

    })
    for (let i = 0; i < data.length; i++) {
      let entity = data[i];
      let type = objectType;
      let entityName = entity.name;
      let meta_id = entity.meta_id;
      let objectId = entity.id;
      console.log(type)

      // 实体类
      if (type === 'META_ENTITY') {
        let style = "shape=mxgraph.flowchart.process;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=middle;";
        let objectXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        objectXml += "<root>";
        objectXml += "<model tooltip=\"" + entityName + "\" type=\"META_ENTITY\">";
        objectXml += "<entity metaId=\"" + meta_id + "\" display=\"LABEL_ROUND_RECTANGLE\" sLabel=\"\" isDataDefinition='true'  tooltip=\"" + entityName + "\" label=\"" + entityName + "\" objectId=\"" + objectId + "\"/>";
        objectXml += "</model>";
        objectXml += "</root>";
        const objectNode = mxUtils.parseXml(objectXml).documentElement;
        const objectList = objectNode.getElementsByTagName('model');
        for (let i = 0; i < objectList.length; i++) {
          const obj = objectList[i];
          fns.push(this.createVertexTemplateEntry(style, parseInt("70"), parseInt("35"), obj.children[0], entityName, null, null, ''));
        }
      }

      // 关系
      if (type === 'META_RELATIONSHIP') {
        let objectXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        objectXml += "<root>";
        objectXml += "<model tooltip=\"" + entityName + "\" type=\"META_RELATIONSHIP\">";
        objectXml += "<entity metaId=\"" + meta_id + "\" display=\"LINE_ORDINARY_TREE_LINE\" sLabel=\"\" isDataDefinition='true'  tooltip=\"" + entityName + "\" label=\"" + entityName + "\" objectId=\"" + objectId + "\"/>";
        objectXml += "</model>";
        objectXml += "</root>";
        const objectNode = mxUtils.parseXml(objectXml).documentElement;
        const objectList = objectNode.getElementsByTagName('model');
        for (let i = 0; i < objectList.length; i++) {
          const obj = objectList[i];
          fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;', 50, 50, obj.children[0], entityName, null, ''));
        }
      }

    }

    for (let i = 0; i < fns.length; i++) {
      content.appendChild(fns[i](content));
    }

  }));

};

/**
 * 添加领域数据库调色板函数。
 * 通过AJAX加载领域数据库的实体数据，为每个实体创建对应的调色板项目，支持分类和属性管理。
 *
 * @param {Object} entity - 实体对象，包含objectNameEn、objectName、viewId、objectId等属性
 * @param {boolean} expanded - 是否初始展开调色板
 */
Sidebar.prototype.addDomainPaletteFunctions = function (entity, expanded) {

  const id = "div_domain_" + entity.objectNameEn;
  const title = "[领域数据库] - " + entity.objectName;
  const viewId = entity.viewId;
  const objectId = entity.objectId;
  const objectType = entity.objectType.name;
  const objectName = entity.objectName;
  const objectNameEn = entity.objectNameEn;

  // 如果是实体类
  if (objectType === "META_ENTITY") {

    // 展开栏事件
    this.addPalette(id, title, expanded, mxUtils.bind(this, async function (content) {

      console.log("addDomainPaletteFunctions.addPalette...");
      // 是否是时序图
      console.log("isTimeSequenceDiagramView:" + isTimeSequenceDiagramView);

      // cell对象
      const fns = [];
      // 领域数据
      const data = [];
      // 对象分类
      let classification = null;
      // 字段集合
      let attributeList = null;
      // 对象所属分类
      let attributeOfClassification = null;

      await window.$axios.get(contextPath + "/difine/entitydata_domain", {
        params: {
          viewId: viewId,
          objectId: objectId
        }
      }).then((responseText) => {
        if (responseText && responseText.statusCode === 200) {
          $.each(responseText.rows, function (index, row) {
            data.push(row);
          });
        }
      }).catch(e => {

      })

      await window.$axios.get(contextPath + "/difine/getClassification", {
        params: {
          objectId: objectId
        }
      }).then((responseText) => {
        if (responseText && responseText.statusCode === 200 && responseText.data) {
          classification = responseText.data.classification;
          attributeList = responseText.data.attributeList;
          attributeOfClassification = responseText.data.attributeOfClassification;
        }
      }).catch(e => {

      })

      for (let i = 0; i < data.length; i++) {

        let entity = data[i];
        let type = objectType;
        let entityName = entity.name;
        let meta_id = entity.meta_id;
        let dataId = entity.id;
        let class_flag = entity.class_flag; //是否是class,0不是,1是

        console.log(entity);

        // 实体
        if (type === 'META_ENTITY') {

          // 如果是时序图 如果是类
          if (isTimeSequenceDiagramView && class_flag === '0') {

            let objectXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
            objectXml += "<root>";
            objectXml += "<model tooltip=\"" + entityName + "\" sysMLRectangle=\"" + 1 + "\"  type=\"META_ENTITY\">";
            objectXml += "<entity metaId=\"" + meta_id + "\" name=\"" + objectName + "\" name_en=\"" + objectNameEn + "\" sysMLRectangle=\"1\" display=\"LABEL_TIME_BUSINESS\" sLabel=\"\" dataSource='domain' isDomainModel='true' class_flag=\"" + class_flag + "\" tooltip=\"" + entityName + "\" label=\"" + entityName + "\" eObjectId=\"" + objectId + "\" domaineObjectId=\"" + dataId + "\" objectId='' />";
            objectXml += "</model>";
            objectXml += "</root>";
            const objectNode = mxUtils.parseXml(objectXml).documentElement;
            const objectList = objectNode.getElementsByTagName('model');
            const objType = "sysMLRectangle";
            const style = "shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;";
            const width = 108;
            const height = 500;

            for (let i = 0; i < objectList.length; i++) {
              const obj = objectList[i];
              console.log(obj);
              fns.push(this.createVertexTemplateEntry(style, width, height, obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
            }

          } else {

            //let style = "shape=mxgraph.flowchart.process;whiteSpace=wrap;html=1;labelPosition=center;verticalLabelPosition=middle;align=center;verticalAlign=middle;";
            let objectXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
            objectXml += "<root>";
            objectXml += "<model tooltip=\"" + entityName + "\" sysMLRectangle=\"" + 1 + "\"  type=\"META_ENTITY\">";
            objectXml += "<entity metaId=\"" + meta_id + "\" name=\"" + objectName + "\" name_en=\"" + objectNameEn + "\" display=\"LABEL_ROUND_RECTANGLE\" sLabel=\"\" dataSource='domain' isDomainModel='true' sysMLRectangle='1' class_flag=\"" + class_flag + "\"  tooltip=\"" + entityName + "\" label=\"" + entityName + "\" eObjectId=\"" + objectId + "\" domaineObjectId=\"" + dataId + "\" objectId='' />";
            objectXml += "</model>";
            objectXml += "</root>";
            const objectNode = mxUtils.parseXml(objectXml).documentElement;
            const objectList = objectNode.getElementsByTagName('model');

            for (let i = 0; i < objectList.length; i++) {

              const obj = objectList[i];
              //console.log(obj);
              //obj.children[0].setAttribute("label", label);
              //fns.push(this.createVertexTemplateEntry(style, parseInt("70"), parseInt("35"), obj.children[0], entityName, null, null, ''));

              const displayNode = this.getDisplay(obj.children[0].getAttribute('display'));
              let width = displayNode.getAttribute('w');
              let height = displayNode.getAttribute('h');
              window.vertexValue = obj.children[0];
              let style = displayNode.getAttribute('style');
              const displayType = displayNode.getAttribute('display');
              let objType = "";

              if (obj.getAttribute('sysMLRectangle') == '1' && displayType != 'LABEL_TIME_BUSINESS') {
                var className = obj.children[0].getAttribute('name');
                var objName = className;
                //if (obj.getAttribute('class_flag') == '1') {
                //    objName = className + "的实例";
                //}

                style = 'shape=rect;html=1;overflow=fill;whiteSpace=wrap;align=center;';
                //if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
                style += 'container=1;'
                //}

                width = 160;
                height = 220;
                const label = "<div style='margin:0px;text-align:center;background-color: rgb(218, 232, 252);'>" +
                  "&lt;&lt;" + className + "&gt;&gt;<br/>" +
                  "<b>" + entityName + "</b></div><hr/>" +
                  //"<p style='margin:0px;margin-left:8px;text-align:left;'>" + "名称=" + objName + "</p>" +
                  "</div>";

                // var label = '<div style="float: left;width: 100%;background-color: rgb(218, 232, 252)"><p style="margin:0px;margin-top:4px;text-align:center;">' +  '&lt;&lt;'+ className +'&gt;&gt;<br/>' + '</p><hr style="margin-bottom: 0px;"/></div>';
                //const dataZh = entityConvertToZh(objectId, entity);
                //console.log(dataZh);
                let attrText = "";

                if (entity) {
                  //const classes = dataZh.classes;
                  //const entityData = dataZh.entityData;
                  // 匪类拼接 属性 p 标签
                  $.each(classification, function (index, c) {
                    //console.log(c);
                    attrText += "<p style='margin: 0px;margin-left: 8px ;text-align: center'><i style='font-size: 10px'>" + c + "</i></p>";
                    $.each(attributeList, function (index, name) {
                      // 计算字段所属分类
                      const temp = eObjectAttributeOfClass(attributeOfClassification, name);
                      // 如果字段是当前分类分类
                      if (c === temp.classification) {
                        const name = temp.name;
                        const nameEn = temp.nameEn;
                        const value = getEntityValue(entity, nameEn);
                        attrText += "<p style='margin: 0px;margin-left: 8px ;text-align: left'>" + name + "：" + value + "</p>";
                      }
                    });
                    attrText += "<hr>";
                  });
                }

                var attrLable = "<div style='float: left;width: 100%;margin-top: 5px;'>" + attrText + "</div>";
                obj.children[0].setAttribute("label", label + attrLable);
                objType = "sysMLRectangle";

              }

              if (style.indexOf('swimlane') < 0 && obj.getAttribute('container_entity') == '1') {
                style += 'container=1;'
              }

              fns.push(this.createVertexTemplateEntry(style, parseInt(width), parseInt(height), obj.children[0], obj.getAttribute('tooltip'), null, null, '', objType));
            }
          }

        }

        // 关系
        // if (type === 'META_RELATIONSHIP') {
        //     let objectXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
        //     objectXml += "<root>";
        //     objectXml += "<model tooltip=\"" + entityName + "\" type=\"META_RELATIONSHIP\">";
        //     objectXml += "<entity metaId=\"" + meta_id + "\" display=\"LINE_ORDINARY_TREE_LINE\" sLabel=\"\" isDataDefinition='true'  tooltip=\"" + entityName + "\" label=\"" + entityName + "\" objectId=\"" + objectId + "\"/>";
        //     objectXml += "</model>";
        //     objectXml += "</root>";
        //     const objectNode = mxUtils.parseXml(objectXml).documentElement;
        //     const objectList = objectNode.getElementsByTagName('model');
        //     for (let i = 0; i < objectList.length; i++) {
        //         const obj = objectList[i];
        //         fns.push(this.createEdgeTemplateEntry('endArrow=classic;html=1;entryPerimeter=0;exitPerimeter=0;', 50, 50, obj.children[0], entityName, null, ''));
        //     }
        // }
      }

      for (let i = 0; i < fns.length; i++) {
        //console.log(fns);
        content.appendChild(fns[i](content));
      }

    }));
  }

};

/**
 * 添加图片调色板函数。
 * 通过AJAX加载指定分类的图片资源，为每张图片创建对应的调色板项目。
 *
 * @param {Object} entity - 图片分类实体对象，包含id、description等属性
 * @param {boolean} expanded - 是否初始展开调色板
 */
Sidebar.prototype.addPicturePaletteFunctions = function (entity, expanded) {

  //图片类别 r_picture_store
  const id = entity.id;
  const title = "[图片图标] - " + entity.description;

  this.addPalette(id, title, expanded, mxUtils.bind(this, async function (content) {
    //alert(id);
    const fns = [];
    const imgList = [];

    await window.$axios.get(contextPath + "/picture/findPictureAll", {
      params: {
        categoryId: id
      }
    }).then((responseText) => {
      if (responseText && responseText.statusCode === 200) {
        $.each(responseText.data, function (index, entity) {
          imgList.push(entity);
        })
      }
    }).catch(e => {
      console.log("ajax fail.");
    })
    // console.log(imgList);
    for (var i = 0; i < imgList.length; i++) {
      const imgEntity = imgList[i];
      const imgId = imgEntity.id;
      const title = imgEntity.name;
      const imgURL = contextPath + "/picture/pictureView.dhtml?id=" + imgId;
      fns.push(this.createVertexTemplateEntry('image;html=1;image=' + imgURL, this.defaultImageWidth, this.defaultImageHeight, '', title, title != null, null, title));
    }
    for (var i = 0; i < fns.length; i++) {
      content.appendChild(fns[i](content));
    }
  }));

};

/**
 * 向侧边栏添加一个调色板。
 * 创建调色板的标题和容器，并处理展开/折叠状态。
 *
 * @param {string} id - 调色板的唯一标识符
 * @param {string} title - 调色板显示的标题
 * @param {boolean} expanded - 是否初始展开调色板
 * @param {Function} onInit - 初始化调色板内容的回调函数
 */
Sidebar.prototype.addPalette = function (id, title, expanded, onInit) {
  const elt = this.createTitle(title);
  elt.id = 'a_' + id;
  this.container.appendChild(elt);

  const div = document.createElement('div');
  div.id = id;
  div.className = 'geSidebar';

  // 在IE10及更高版本中禁用内置的平移和缩放
  if (mxClient.IS_POINTER) {
    div.style.touchAction = 'none';
  }

  if (expanded) {
    onInit(div);
    onInit = null;
  } else {
    div.style.display = 'none';
  }

  this.addFoldingHandler(elt, div, onInit);

  var outer = document.createElement('div');
  outer.appendChild(div);
  this.container.appendChild(outer);

  // 保持对DOM节点的引用
  if (id != null) {
    this.palettes[id] = [elt, outer];
  }

  return div;
};

/**
 * 为指定的标题元素和内容添加折叠/展开处理程序。
 * 处理点击事件以切换内容的显示状态，并管理初始化逻辑。
 *
 * @param {HTMLElement} title - 标题DOM元素
 * @param {HTMLElement} content - 内容DOM元素
 * @param {Function} funct - 初始化内容的回调函数
 */
Sidebar.prototype.addFoldingHandler = function (title, content, funct) {
  var initialized = false;

  // 避免IE6-8中的混合内容警告
  if (!mxClient.IS_IE || document.documentMode >= 8) {
    title.style.backgroundImage = (content.style.display == 'none') ? 'url(\'' + this.collapsedImage + '\')' : 'url(\'' + this.expandedImage + '\')';
  }

  title.style.backgroundRepeat = 'no-repeat';
  title.style.backgroundPosition = '0% 50%';

  mxEvent.addListener(title, 'click', mxUtils.bind(this, function (evt) {

    // alert("abcd");
    // console.log(this);
    // console.log(content);

    if (content.style.display == 'none') {
      if (!initialized) {
        initialized = true;
        if (funct != null) {
          // 在Mac上等待光标不会显示
          title.style.cursor = 'wait';
          var prev = title.innerHTML;
          title.innerHTML = mxResources.get('loading') + '...';
          window.setTimeout(function () {
            content.style.display = 'block';
            title.style.cursor = '';
            title.innerHTML = prev;
            var fo = mxClient.NO_FO;
            mxClient.NO_FO = Editor.prototype.originalNoForeignObject;
            funct(content, title);
            mxClient.NO_FO = fo;
          }, (mxClient.IS_FF) ? 20 : 0);
        } else {
          content.style.display = 'block';
        }
      } else {
        content.style.display = 'block';
      }
      title.style.backgroundImage = 'url(\'' + this.expandedImage + '\')';
    } else {
      title.style.backgroundImage = 'url(\'' + this.collapsedImage + '\')';
      content.style.display = 'none';
    }

    mxEvent.consume(evt);

  }));

  // 阻止聚焦

  mxEvent.addListener(title, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown',
    mxUtils.bind(this, function (evt) {
      evt.preventDefault();
    }));
};

/**
 * 根据指定的ID移除调色板。
 * 从DOM中移除调色板的标题和内容元素，并清理相关引用。
 *
 * @param {string} id - 要移除的调色板ID
 */
Sidebar.prototype.removePalette = function (id) {
  var elts = this.palettes[id];

  if (elts != null) {
    this.palettes[id] = null;

    for (var i = 0; i < elts.length; i++) {
      this.container.removeChild(elts[i]);
    }

    return true;
  }

  return false;
};

/**
 * 添加指定的图片调色板。
 * 为图片列表创建调色板条目，支持自定义前缀、后缀和标签。
 *
 * @param {string} id - 调色板的唯一标识符
 * @param {string} title - 调色板标题
 * @param {string} prefix - 图片URL的前缀
 * @param {string} postfix - 图片URL的后缀
 * @param {Array} items - 图片项数组
 * @param {Array} titles - 图片标题数组
 * @param {Array} tags - 标签数组
 */
Sidebar.prototype.addImagePalette = function (id, title, prefix, postfix, items, titles, tags) {
  const showTitles = titles != null;
  const fns = [];
  for (let i = 0; i < items.length; i++) {
    (mxUtils.bind(this, function (item, title, tmpTags) {
      if (tmpTags == null) {
        var slash = item.lastIndexOf('/');
        var dot = item.lastIndexOf('.');
        tmpTags = item.substring((slash >= 0) ? slash + 1 : 0, (dot >= 0) ? dot : item.length).replace(/[-_]/g, ' ');
      }
      fns.push(this.createVertexTemplateEntry('image;html=1;image=' + prefix + item + postfix, this.defaultImageWidth, this.defaultImageHeight, '', title, title != null, null, this.filterTags(tmpTags)));
    }))(items[i], (titles != null) ? titles[i] : null, (tags != null) ? tags[items[i]] : null);
  }
  this.addPaletteFunctions(id, title, false, fns);
};

/**
 * 为指定的模板创建标签数组。
 * 从包名和模板名生成标签，并允许重复（将在后续步骤中过滤）。
 *
 * @param {string} packageName - 模板的包名
 * @param {string} stencilName - 模板名称
 * @param {string} moreTags - 额外的标签字符串
 * @returns {Array} 标签数组
 */
Sidebar.prototype.getTagsForStencil = function (packageName, stencilName, moreTags) {
  var tags = packageName.split('.');

  for (var i = 1; i < tags.length; i++) {
    tags[i] = tags[i].replace(/_/g, ' ')
  }

  tags.push(stencilName.replace(/_/g, ' '));

  if (moreTags != null) {
    tags.push(moreTags);
  }

  return tags.slice(1, tags.length);
};

/**
 * 添加指定的模板调色板。
 * 从模板文件加载图形元素并添加到调色板中，支持自定义样式和标签。
 *
 * @param {string} id - 调色板的唯一标识符
 * @param {string} title - 调色板标题
 * @param {string} stencilFile - 模板文件路径
 * @param {string} style - 默认样式
 * @param {Array} ignore - 要忽略的模板名称数组
 * @param {Function} onInit - 初始化回调函数
 * @param {number} scale - 缩放比例
 * @param {Object} tags - 标签映射对象
 * @param {Array} customFns - 自定义函数数组
 * @param {string} groupId - 组标识符
 */
Sidebar.prototype.addStencilPalette = function (id, title, stencilFile, style, ignore, onInit, scale, tags, customFns, groupId) {
  scale = (scale != null) ? scale : 1;

  if (this.addStencilsToIndex) {
    // 稍后: 处理异步加载依赖
    var fns = [];

    if (customFns != null) {
      for (var i = 0; i < customFns.length; i++) {
        fns.push(customFns[i]);
      }
    }

    mxStencilRegistry.loadStencilSet(stencilFile, mxUtils.bind(this, function (packageName, stencilName, displayName, w, h) {
      if (ignore == null || mxUtils.indexOf(ignore, stencilName) < 0) {
        var tmp = this.getTagsForStencil(packageName, stencilName);
        var tmpTags = (tags != null) ? tags[stencilName] : null;

        if (tmpTags != null) {
          tmp.push(tmpTags);
        }

        const label = mxResources.get(top._.lowerFirst(top._.camelCase(stencilName.replace(/_/g, ' '))), null, stencilName.replace(/_/g, ' '))
        fns.push(this.createVertexTemplateEntry('shape=' + packageName + stencilName.toLowerCase() + style,
          Math.round(w * scale), Math.round(h * scale), '', label, null, null,
          this.filterTags(tmp.join(' '))));
      }
    }), true, true);

    this.addPaletteFunctions(id, title, false, fns);
  } else {
    this.addPalette(id, title, false, mxUtils.bind(this, function (content) {
      if (style == null) {
        style = '';
      }

      if (onInit != null) {
        onInit.call(this, content);
      }

      if (customFns != null) {
        for (var i = 0; i < customFns.length; i++) {
          customFns[i](content);
        }
      }

      mxStencilRegistry.loadStencilSet(stencilFile, mxUtils.bind(this, function (packageName, stencilName, displayName, w, h) {
        if (ignore == null || mxUtils.indexOf(ignore, stencilName) < 0) {
          content.appendChild(this.createVertexTemplate('shape=' + packageName + stencilName.toLowerCase() + style,
            Math.round(w * scale), Math.round(h * scale), '', stencilName.replace(/_/g, ' '), true));
        }
      }), true);
    }));
  }
};

/**
 * 销毁侧边栏。
 * 清理所有事件监听器、图形实例和DOM元素，释放资源。
 */
Sidebar.prototype.destroy = function () {
  if (this.graph != null) {
    if (this.graph.container != null && this.graph.container.parentNode != null) {
      this.graph.container.parentNode.removeChild(this.graph.container);
    }

    this.graph.destroy();
    this.graph = null;
  }

  if (this.pointerUpHandler != null) {
    mxEvent.removeListener(document, (mxClient.IS_POINTER) ? 'pointerup' : 'mouseup', this.pointerUpHandler);
    this.pointerUpHandler = null;
  }

  if (this.pointerDownHandler != null) {
    mxEvent.removeListener(document, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown', this.pointerDownHandler);
    this.pointerDownHandler = null;
  }

  if (this.pointerMoveHandler != null) {
    mxEvent.removeListener(document, (mxClient.IS_POINTER) ? 'pointermove' : 'mousemove', this.pointerMoveHandler);
    this.pointerMoveHandler = null;
  }

  if (this.pointerOutHandler != null) {
    mxEvent.removeListener(document, (mxClient.IS_POINTER) ? 'pointerout' : 'mouseout', this.pointerOutHandler);
    this.pointerOutHandler = null;
  }
};

/**
 * 单元格和样式映射数组。
 * 存储所有已创建的单元格及其样式信息，用于样式恢复和数据管理。
 */
Sidebar.prototype.cellAndStyleMap = []

/**
 * 实体类型映射。
 * 定义侧边栏中不同实体类型的映射关系，用于数据管理和显示。
 * 提供节点名称到类型的键值对映射。
 */
Sidebar.EntityTypeMap = {
  entity: 'META_ENTITY', // 实体类型
  relation: 'META_RELATIONSHIP', // 关系类型
  quote: 'QUOTE', // 引用类型
  timeaxis: 'TIMEAXIS', // 时间轴类型
  group: 'GROUP', // 分组类型
}

/**
 * 根据单元格的display属性保存单元格和样式信息。
 * 用于在全局保存模式下存储实体的显示信息和样式配置。
 *
 * @param {mxCell} cell - 要保存的图形单元格
 */
Sidebar.prototype.saveCellAndStyleByDisplay = function (cell) {
  // 是否需要保存全局cell
  if (!window.saveCell) return
  if (cell.isEntity()) {
    const display = cell.value.getAttribute('display')
    const name = cell.value.getAttribute('name')
    const metaId = cell.value.getAttribute('metaId')
    const defineId = cell.value.getAttribute('defineId')
    const width = cell.geometry.width
    const height = cell.geometry.height
    const style = cell.style
    const nodeName = cell.value.nodeName
    const type = Sidebar.EntityTypeMap[nodeName]
    if (!type || !display) return

    const index = this.cellAndStyleMap.findIndex(i => i.display === display && i.type === type && i.metaId === metaId && i.name === name)
    const item = {
      cell,
      display,
      metaId,
      defineId,
      style,
      name,
      width,
      height,
      nodeName,
      type: type,
    }
    if (index === -1) {
      this.cellAndStyleMap.push(item)
    } else {
      this.cellAndStyleMap[index] = item
    }
  }
}